How to prevent exit via hardware back button on root page?

Let’s say I am on the rootPage, and I press the back button on my device, this will cause the app to minimize/exit. I want to handle it based on which rootPage I am on (my app has multiple areas where I am using the cordova-google-map plugin, which forces me to make those pages as rootPage else the other pages show up above the map and below the current page).

  1. Do double back press to exit
  2. Go to a different page.

Any suggestions?


r u getting any solution for prevent hardware back button?
basically i want to add function on hardware back button pressed