Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PhoneGap iOS application 'deviceready' event - initial entry vs resume

Tags:

ios

cordova

I am using PhoneGap to create a native iOS app. The app implements an iOS scheme so that it can be invoked from mobile Safari like myapp://?parameters. The app activities depend on the input parameters, i read those by handling the 'deviceready' event.

The problem is that after initial execution the app remains in the background, and any subsequent calls (from the browser) do not fire another 'deviceready', and as a result i cannot get the new parameters.

Any ideas? Thanks!

like image 236
John D Avatar asked Jan 18 '26 09:01

John D


1 Answers

Did you manage to get the resume event to fire in the end?

I'm having trouble with this as well - I have the following code:

window.addEventListener('load', function () {
    document.addEventListener('deviceready', onDeviceReady, false);
}, false);

function onDeviceReady() {
    document.addEventListener('resume', onResume, false);
    document.addEventListener('pause', onPause, false);
    document.addEventListener('online', onOnline, false);
    document.addEventListener('offline', onOffline, false);
}

function onResume() {
    alert('resume');
}

function onPause() {
    alert('pause');
}

function onOnline() {
    alert('online');
}

function onOffline() {
    alert('offline');
}

And although the deviceready and online events appear to be firing, I can't seem to get the resume event to fire. Any light anyone could shed on this would be much appreciated!

like image 72
rwbutler Avatar answered Jan 20 '26 00:01

rwbutler



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!