Rohit_Ramkumar February 2016

Update database on app force close or crash

I have a local database where I maintain some document statuses and update them(in-progress to success or failure) as they get uploaded. How do I updated the status (in-progress to failure) if the app crashes or is force closed ?

Currently I am using volley to upload some documents and on response updated the database. My only concern is that the database will be inconsistent if the user force closes or the app crashes. Is it a good idea to make the api call inside a service. Are there any other alternatives ?

Answers


Guru_VL February 2016

  1. If the user force closes:

    Its not possible to handle.

  2. The app crashes:

    Yes can be handled by using global exception handler set in Application class. Please refer below links:

    http://developer.android.com/reference/java/lang/Thread.UncaughtExceptionHandler.html

    Similar question & answer Need to handle uncaught exception and send log file

Post Status

Asked in February 2016
Viewed 2,101 times
Voted 12
Answered 1 times

Search




Leave an answer