Search code examples
androidrateondestroy

In android - how to I make an activity launch when someone closes an app?


I'd like to add an activity to my app asking users to rate it, but I'd rather have it only launch when they are exiting out of the app using the back button (so that it doesn't interfere with usefulness). I have a few apps that if I exit out by repeatedly hitting the back button, I get a toast that says 'Tap back to exit ______' so I'm pretty sure that this is possible.


Solution

  • You can start another activity using intent on your onBackPressed method. With this approach you can fire an intent to google play. But i think it would be frustrating for user. In my opinion better way of achieving what you want is using some kind of popup. This library might help you out.