hi,
I have a "Quit" button in my app. How do I close the app upon clicking the button?
Thanks,
M&M
hi,
I have a "Quit" button in my app. How do I close the app upon clicking the button?
Thanks,
M&M
I think for Android it's codenavigator.app.exitApp();/code
As far as I know for iOS, you're not allowed to close it programmatically. You are forced to use the home button.
hi,
right but then how do I determine programmatically whether it is android or iOS?
Thanks,
M&M
hi,
the reason is that navigator.app.exitApp(); works only in android. So i want to check if the OS is android then execute that command, otherwise will do nothing.
Thanks,
M&M
This works
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isMobile.Android() isMobile.BlackBerry() isMobile.iOS() isMobile.Opera() isMobile.Windows());
}
Code: Select all
};
if ( isMobile.Android() ) {
// Do whateva you wana do
}
Hello!
Just execute the following code prenavigator.app.exitApp();/pre