title: Cordova backbutton event not working
body: <p>I am currently using Apache Cordova version 5.1.1 to build native apps for iOS and Android. Everything seems to be working fine, except the <code>backbutton</code> event inside of Android.</p>
  
  <p>I would like to use the back button to navigate through the app's screens (the app is built using <a href="http://www.idangero.us/framework7/docs/router-api.html#.VdRYRBNVhBc" rel="nofollow">Framework7</a>), but for some reason the <code>backbutton</code> event never triggers. Here's a review of the (simplified) code that I am using:</p>
  
  <pre><code>if( window.cordova )
  {
      document.addEventListener("deviceready", function() { MRC.init(); }, false);
  }
  
  var MRC = 
  {
      init: function()
      {
          if( window.cordova )
          {
              cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
              cordova.plugins.Keyboard.disableScroll(true);
  
              // Prevent the back button:
              document.addEventListener("backbutton", function(e) {
  
                  e.preventDefault();
                  MRC.view.router.back();
  
                  return false;
  
              }, false);
          }
      }f
  }
  </code></pre>
  
  <p>Everything inside of the <code>init()</code> function works, but the <code>backbutton</code> event listener never triggers, and when a user presses their hardware back button on an Android device, the app closes, rather than going to the previous view. </p>
  
  <p>According to Cordova's documentation:</p>
  
  <blockquote>
    <p>This is an event that fires when the user presses the back button.</p>
  
  <pre><code>document.addEventListener("backbutton", yourCallbackFunction, false);
  </code></pre>
    
    <p><strong>Details</strong></p>
    
    <p>If you need to override the default back button behaviour you can
    register an event listener for the 'backbutton' event. It is no longer
    necessary to call any other method to over ride the back button
    behaviour. Now, you only need to register an event listener for
    'backbutton'.</p>
    
    <p>Typically, you will want to attach an event listener with
    document.addEventListener once you receive the Cordova 'deviceready'
    event.</p>
    
    <p><strong>Supported Platforms</strong></p>
    
    <ul>
    <li>Android</li>
    <li>BlackBerry WebWorks (OS 5.0 and higher)</li>
    <li>Windows Phone 7 and 8</li>
    </ul>
  </blockquote>
  
  <p>Has anyone encountered a similar problem here, or is there a workaround that I have missed?</p>