Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70429

Ionic.Platform.exitApp() not working in android

$
0
0

@tushar4ic wrote:

I am trying to exit from the app on soft-back-button press from home screen. Following code inside app.js does not work -

angular.module('starter', ['ionic', 'MyController'] )
.run(function($ionicPlatform, $ionicHistory, $ionicPopup) {
   $ionicPlatform.ready(function() {

    $ionicPlatform.registerBackButtonAction(function(event) {
        var currentState = $ionicHistory.currentStateName();
        if (currentState == 'tab.business' || currentState == 'tab.personal') {
                console.log('About to exit the app');
                ionic.Platform.exitApp();
                 navigator.app.exitApp(); // none works
        } else {
            $ionicHistory.goBack();
        }
    }, 101);

});

Please help

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 70429

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>