$ionicPlatform.ready(function() {
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
cordova.plugins.backgroundMode.enable();
cordova.plugins.backgroundMode.setDefaults({
title: 'Dj Robert',
text: '-Live-'
})
});
// Disable BACK button on home
$ionicPlatform.registerBackButtonAction(function(event) {
if (Scopes.get('status')==2) {
// your check here
ionic.Platform.exitApp();
}
else if (Scopes.get('status')==4||Scopes.get('status')==undefined) { // your check here
cordova.plugins.backgroundMode.disable();
$ionicPopup.confirm({
title: 'System warning',
template: 'are you sure you want to exit?'
}).then(function(res) {
if (res) {
ionic.Platform.exitApp();
}
})
}
console.log(Scopes.get('status'));
}, 100);
This is my first post so sorry if it’s not formatted correctly.
The app close when i exit using the back button but enter background mode if i switch from it without unsing the back button