PhoneGap - android exit on backbutton
Date : March 29 2020, 07:55 AM
To fix this issue You need to wait for the device to be ready to add the event listener: document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady(){
document.addEventListener("backbutton", function(e){
if($.mobile.activePage.is('#homepage')){
e.preventDefault();
navigator.app.exitApp();
}
else {
navigator.app.backHistory();
}
}, false);
}
|
Phonegap + jquery mobile + backbutton + pageinit
Date : March 29 2020, 07:55 AM
may help you . The pageinit event is only fired once the page is loaded into the DOM, so it will only be fired once. $('#staticsPage').on('pageshow', function(){
alert(staticsPage Init);
init_statistics();
});
document.addEventListener("deviceready", appReady, false);
//HANDLE BACK BUTTON
function appReady()
{
document.addEventListener('backbutton', function(e){
var activePage = $.mobile.activePage.attr('id');
if(activePage == 'menuPage')
{
e.preventDefault();
navigator.app.exitApp();
}
else if(activePage == 'staticsPage')
{
e.preventDefault();
$.mobile.changePage('#menuPage');
}
else
{
navigator.app.backHistory();
}
}, false);
}
|
Phonegap - Android backbutton has to be pushed twice for the app to exit
Date : March 29 2020, 07:55 AM
help you fix your problem No, this is no normal behaviour. The backbutton will be available when deviceready event was fired. E.g. function onDeviceReady(){
document.addEventListener("backbutton", function(e){
if($.mobile.activePage.is('#homepage')){
e.preventDefault();
navigator.app.exitApp();
}
else {
navigator.app.backHistory()
}
}, false);
}
|
Phonegap 3.0 and android backbutton
Date : March 29 2020, 07:55 AM
help you fix your problem Ok, fixed this. For some reason phonegap is not adding their plugin called App which have all that functions. just add to config.xml next lines: <feature name="App">
<param name="android-package" value="org.apache.cordova.App" />
</feature>
|
phonegap 3 android backbutton not working
Date : March 29 2020, 07:55 AM
|