backbone-directory
backbone-directory copied to clipboard
Using in Cordova and Custom URL Plugin
Hi there,
I've created a new Hybrid application in Visual Studio 2013 and copied the demo project over so that I can see the demo just fine in the emulator. I would like to add another cordova plugin so that I can launch the application from a browser link, the plugin I have used is this one,
http://plugreg.com/plugin/EddyVerbruggen/LaunchMyApp-PhoneGap-Plugin
And I've added the following code to the bottom of app.js,
function handleOpenURL(url) {
setTimeout(function () {
alert("received url: " + url);
}, 0);
}
I've also added the following scripts to the head tag of index.html (just under styles.css),
<script src="cordova.js"></script>
<script src="scripts/platformOverrides.js"></script>
<script src="scripts/index.js"></script>
So the actual problem is this
1: If the app is not running and I launch it from an URL it doesn't initialise correctly and I get a blank screen. 2. If the app is already running in the state as in step 1. and I launch it from an URL it works correctly and I get my alert, plus the page renders
I'm not sure what's causing this but it's the second template engine I've tried that's done this.
If anyone here has VS 2013 and the latest Hybrid App CTP, I also have a sample project. Any ideas how to diagnose / fix this?
Okay, i've found the primary cause, but am sure there is a logical fix somewhere. The issue is with the extra scripts that are loaded while cordova is starting up, on slow devices it is just too slow. I've just run it on an NVidia Shield which is super fast and it worked perfect first time.
So seeing as this is a race condition, where should I be shifting my code to in order to get this to work on slower devices?
deviceready has not fired after 5 seconds. File: cordova.js, Line: 1154, Column: 17 Channel not fired: onPluginsReady File: cordova.js, Line: 1147, Column: 21 Channel not fired: onCordovaReady File: cordova.js, Line: 1147, Column: 21 Channel not fired: onDOMContentLoaded File: cordova.js, Line: 1147, Column: 21
these are the errors that appear in visual studio during a slow startup