0

I am developing a kiosk style android application and it is extremely important to be able to remotely restart the application, or have it somehow autostart itself, should it crash or quit. I know you can easily monitor crashes remotely with tools like BugSense, but is there a way to remotely restart an application once you know it has crashed?

This is a similar question but targeting Windows apps

Best way to detect an application crash and restart it?

Community
  • 1
  • 1
Bachalo
  • 6,965
  • 27
  • 95
  • 189
  • possible duplicate of [Android App Restarts upon Crash/force close](http://stackoverflow.com/questions/12560590/android-app-restarts-upon-crash-force-close) – gipinani Jan 23 '14 at 22:59

1 Answers1

0

You can restart your application using

System.exit(2)

you can invoke this by sending anything to the mobile app and just use this command

You can handle uncaught exceptions from a class extended from android.app.applicaton so you forward all exceptions to that class by doing this

Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler()); 

on creation of the application extended class.

And the Exception Handler class let it extend an IntentService and implements UncaughtExceptionHandler. That will be called on app crash. Hope this helps

youssefhassan
  • 1,067
  • 2
  • 11
  • 17
  • Thanks, but AFTER an application has crashed or quit, how would this work? Wouldn't the application have to receive either an explicit or implicit intent with corresponding intent filter action in the manifest? And how would this intent be triggered remotely? – Bachalo Jan 24 '14 at 01:29