Search code examples
androidreactjsionic-frameworkgoogle-playcapacitor

Android apps made with Ionic Capacitor and the Back Button


I've written a web app using ReactJS and it works great. There are a few screens and using the browser's back button correctly navigates to the correct screen.

I'd like to turn this application into an Android app so I've been using Ionic Capacitor. The resulting Android app works correctly except for one thing. If I use the Android device's back button I do not navigate to the screen I was previously on. Instead, the application exits and I go to the Android Home Screen.

I'm not sure why this is happening. I'm concerned because one of the criteria of being accepted into Google Play is correct processing of the back button.

Any idea of what's going on and more importantly, how to fix this issue?


Solution

  • you have to install this:

    npm i @capacitor/app
    

    and the back button will work