Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using in Cordova and Custom URL Plugin #11

Open
npateman opened this issue Oct 1, 2014 · 2 comments
Open

Using in Cordova and Custom URL Plugin #11

npateman opened this issue Oct 1, 2014 · 2 comments

Comments

@npateman
Copy link

npateman commented Oct 1, 2014

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?

@npateman
Copy link
Author

npateman commented Oct 1, 2014

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?

@npateman
Copy link
Author

npateman commented Oct 1, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant