I have developed an app and I need it the hole day up. But somethimes it just crash. I was thinking on creating an autostart with an interval, for ex, every 30 min, the app gets up, but I can't find the way. Any ideas? thanks in advance. My app is an Activity, like a server, just to my personal use.
-
"it just crash" is not sufficient to help (log? what happens?)… Your application is composed of Services/Activities/ContentProviders/??? Creating an autostart seems a dirty workaround to me… – Renaud Oct 18 '11 at 22:39
2 Answers
First you should really figure out why your application is crashing and fix that first. Second are you sure your application is crashing? It might be getting stopped by the OS in an attempt to save memory.
Is your app an Activity, and do you want it to run in the background? If so you should use a service instead. http://developer.android.com/guide/topics/fundamentals/services.html Activities are really only meant to be running when they are visible on the screen. Any work that is done without a visible Activity should be done in a service.

- 20,123
- 10
- 60
- 89
-
Thank you, yes that's what I'm looking for with UncatghtExceptionHandler. It's an activity not a service, – Juanma Crescente Oct 22 '11 at 03:08
See AlarmManager
to invoke the app or service and PowerManager
to keep the phone awake (or else you app wont run due to sleep mode).
Btw, I hope you are dooing this just for test, as this would drain the battery quickly and no one would want to run an app like this.

- 79,991
- 11
- 123
- 154
-
Actually it's an SMS server and the app it's for me. Thank you I'm seeing your advice now – Juanma Crescente Oct 22 '11 at 03:09