- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am making an app for Android using HTML-JavaScript on Intel-XDK. I'm overriding the Android Back Button function and Android Menu Button using the following code.
<script src="cordova.js" type="text/javascript"></script> <script type="text/javascript"> /* Android Back Button ----------------------------------------------- */ function backButtonPressed() { isPaused = true; // To Pause } document.addEventListener("backbutton", backButtonPressed, false); /* Android Menu Button ----------------------------------------------- */ function menuButtonPressed() { isPaused = false; // To false } document.addEventListener("menubutton", menuButtonPressed, false); </script>
Both are working perfectly in Intel-XDK Emulate. But when I am running them in an android device, the menu button code is working but back button code is not working and it's exiting the app. What to do to stop this behavior (ie, exiting the app) and start running my own code?
Note: I also tried code from https://software.intel.com/en-us/node/493108 but still not working in Mobile and is working in Emulator.
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How are you running it on the device? If you're using App Preview or the debug tab, there may be a problem causing it to not work (cf. http://stackoverflow.com/questions/34511358/android-back-button-exiting-apps-instead-of-running-its-new-code). ; If you haven't tried building the app and running it on a device, give that a try and let us know.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, Your answer is Right. Debug and Apps Preview are not showing the final results.
But me got another problem. Yes, I was trying in "Test Tab, Debug Tab, Apps Preview" till now and there my BackButton is not working and MenuButton was working but now I build it on "Crosswalk for Android" then run the APK on my mobile and now BackButton is working but MenuButton stopped working. Now what to do...???

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page