<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Android Back Button Exiting Apps Instead Of Running Its New Code in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Android-Back-Button-Exiting-Apps-Instead-Of-Running-Its-New-Code/m-p/1068990#M57403</link>
    <description>&lt;P&gt;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.&lt;/P&gt;

&lt;PRE class="brush:jscript;"&gt;&amp;lt;script src="cordova.js" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type="text/javascript"&amp;gt;
/* 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);
&amp;lt;/script&amp;gt;&lt;/PRE&gt;

&lt;P&gt;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?&lt;/P&gt;

&lt;P&gt;Note: I also tried code from &lt;A href="https://software.intel.com/en-us/node/493108"&gt;https://software.intel.com/en-us/node/493108&lt;/A&gt; but still not working in Mobile and is working in Emulator.&lt;/P&gt;</description>
    <pubDate>Thu, 31 Dec 2015 06:40:39 GMT</pubDate>
    <dc:creator>Muhammad_H_</dc:creator>
    <dc:date>2015-12-31T06:40:39Z</dc:date>
    <item>
      <title>Android Back Button Exiting Apps Instead Of Running Its New Code</title>
      <link>https://community.intel.com/t5/Software-Archive/Android-Back-Button-Exiting-Apps-Instead-Of-Running-Its-New-Code/m-p/1068990#M57403</link>
      <description>&lt;P&gt;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.&lt;/P&gt;

&lt;PRE class="brush:jscript;"&gt;&amp;lt;script src="cordova.js" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type="text/javascript"&amp;gt;
/* 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);
&amp;lt;/script&amp;gt;&lt;/PRE&gt;

&lt;P&gt;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?&lt;/P&gt;

&lt;P&gt;Note: I also tried code from &lt;A href="https://software.intel.com/en-us/node/493108"&gt;https://software.intel.com/en-us/node/493108&lt;/A&gt; but still not working in Mobile and is working in Emulator.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Dec 2015 06:40:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Android-Back-Button-Exiting-Apps-Instead-Of-Running-Its-New-Code/m-p/1068990#M57403</guid>
      <dc:creator>Muhammad_H_</dc:creator>
      <dc:date>2015-12-31T06:40:39Z</dc:date>
    </item>
    <item>
      <title>How are you running it on the</title>
      <link>https://community.intel.com/t5/Software-Archive/Android-Back-Button-Exiting-Apps-Instead-Of-Running-Its-New-Code/m-p/1068991#M57404</link>
      <description>&lt;P&gt;How are you running it on the device?&amp;nbsp; If you're using App Preview or the debug tab, there may be a problem causing it to not work (cf. &lt;A href="http://stackoverflow.com/questions/34511358/android-back-button-exiting-apps-instead-of-running-its-new-code).&amp;nbsp;" target="_blank"&gt;http://stackoverflow.com/questions/34511358/android-back-button-exiting-apps-instead-of-running-its-new-code).&amp;nbsp;&lt;/A&gt;; If you haven't tried building the app and running it on a device, give that a try and let us know.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Dec 2015 20:09:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Android-Back-Button-Exiting-Apps-Instead-Of-Running-Its-New-Code/m-p/1068991#M57404</guid>
      <dc:creator>Dale_S_Intel</dc:creator>
      <dc:date>2015-12-31T20:09:55Z</dc:date>
    </item>
    <item>
      <title>Yes, Your answer is Right.</title>
      <link>https://community.intel.com/t5/Software-Archive/Android-Back-Button-Exiting-Apps-Instead-Of-Running-Its-New-Code/m-p/1068992#M57405</link>
      <description>&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="font-size: 13.008px; line-height: 19.512px;"&gt;Yes, Your answer is Right. Debug and Apps Preview are not showing the final results.&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 13.008px; line-height: 19.512px;"&gt;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 "&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.008px; line-height: 19.512px;"&gt;Crosswalk for Android" then run the APK on my mobile and now BackButton is working but MenuButton stopped working. Now what to do...???&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jan 2016 06:19:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Android-Back-Button-Exiting-Apps-Instead-Of-Running-Its-New-Code/m-p/1068992#M57405</guid>
      <dc:creator>Muhammad_H_</dc:creator>
      <dc:date>2016-01-01T06:19:47Z</dc:date>
    </item>
  </channel>
</rss>

