I'm developing an android application using cordova , I want to quit the application when i click on the back button knowing that i'm using Inappbrowser, could someone help me??
Asked
Active
Viewed 3,785 times
0
-
http://stackoverflow.com/questions/12338337/phonegap-android-exit-on-backbutton – Android Surya Jul 26 '16 at 08:00
2 Answers
2
Try this one:
document.addEventListener("deviceready", onDeviceReady, false);
if (navigator.userAgent.match("Android"))
{
document.addEventListener("backbutton", onBackKeyDown, true);
}
function onBackKeyDown(e)
{navigator.app.exitApp();}

Shanmugapriya D
- 306
- 3
- 13
0
Because of the android life cycle (how apps are managed, cached etc.) it is not recommended to close apps. The user should just minimize it. You can stop all background-threads using onPause() method, if you have any.
By force-closing you will drain some battery, because android has to reload everything instead of loading a cached version.

KYL3R
- 3,877
- 1
- 12
- 26