BackAndroid #

Detect hardware back button presses, and programmatically invoke the default back button functionality to exit the app if there are no listeners or if none of the listeners return true. The event subscriptions are called in reverse order (i.e. last registered subscription first), and if one subscription returns true then subscriptions registered earlier will not be called.


BackAndroid.addEventListener('hardwareBackPress', function() { // this.onMainScreen and this.goBack are just examples, you need to use your own implementation here // Typically you would use the navigator here to go to the last state. if (!this.onMainScreen()) { this.goBack(); return true; } return false; });

Methods #

static exitApp() #

static addEventListener(eventName, handler) #

static removeEventListener(eventName, handler) #

You can edit the content above on GitHub and send us a pull request!