From 5bd6b1f0d84e30802466f5f71f6439aa83126a78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Katzer?= Date: Tue, 3 Jan 2017 21:56:57 +0100 Subject: [PATCH] Allow app to override backbutton behaviour --- www/background-mode.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/www/background-mode.js b/www/background-mode.js index 81ec97e..063705d 100644 --- a/www/background-mode.js +++ b/www/background-mode.js @@ -110,6 +110,16 @@ exports.moveToBackground = function () { } }; +/** + * Override the back button on Android to go to background + * instead of closing the app. + * + * @return [ Void ] + */ +exports.overrideBackButton = function () { + document.addEventListener('backbutton', this.moveToBackground, false); +}; + /** * If the mode is enabled or disabled. *