-1

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 ?

android_eng
  • 1,370
  • 3
  • 17
  • 40

1 Answers1

1
  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

Community
  • 1
  • 1
Guru_VL
  • 402
  • 3
  • 6