cordova - Send Application to background mode when back button is pressed in Phonegap -
i have problem phonegap application. want minimize application (send app in background it's still running) when button pressed.
here's code.
document.addeventlistener("backbutton", onbackkeydown, false); function onbackkeydown() { }
if use navigator.app.exitapp();
- application terminate , if use navigator.app.backhistory()
- go previous page.
i want if press button, send me home screen , send application background it's still running. thank you.
you can use plugin when device ready listen backbutton , when onbackkeydown use plugin launch home screen
`document.addeventlistener("backbutton", onbackkeydown, false); function onbackkeydown() { navigator.backbutton.gohome(function() { console.log('success') }, function() { console.log('fail') }); } `
this plugin updated dpa99c answer user cordova >=3
Comments
Post a Comment