Reputation: 387
I want to know whether my app has crashed or exited by the user. Is there any way to do so?
Upvotes: 3
Views: 3580
Reputation: 571
See this: https://developer.android.com/reference/java/lang/Thread.html#setDefaultUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler), it may help :)
There's no such thing as exiting the application by the user. You can always do something when onStop() or onBackPressed() of your main activity is called, but that's all. Just note that it doesn't mean that the app was "exited", but only "left" by the user. You can of course finish the activity from there to make sure the app is really exited.
Upvotes: 3
Reputation: 68187
Technically, there's no exit ideology in Android. Applications are kept on running in background and (if necessary) Android's VM automatically kill stale applications when it requires to free memory.
Regarding app-crash, if the app is crashed, so you may get notified on your Google Play's developer console in case the user has chosen to report the crash.
Upvotes: 0