Question

The question is very strange:

i have done an app that set an Alarm Manager that lunch a service (it does some operation and at the end stopself()) every 5 minutes. For at least 6 month or more (plugged).

This because i have tranformed my phone in a webcam (IP wireless for panorama wiev), so the service started each 5 minutes take a photo and send it by wifi. So there isn't any user interaction and the phone is away from user control. My app works fine with very fine result, but after 5-6 days working something happens and the app crashes. I think that is the Andorid OS that close the app, but i can't understand how it can cancel di alarm manager schedule operation..

The app is installed on a Samsung Galaxy ACE, i'm thinking to root the phone and cancel all other app on the phone, so that may not be problem.

There is a better way to be sure that the app will run for 6 month or more?

Would be better make a custom rom for this pourpose?

Sorry for my english..

Was it helpful?

Solution

Android can (and actually does) kill applications for its internal reasons. So if you need something resurrected, best way is to use broadcast receiver, and schedule repeating alarm with alarm manager (you have choices, whether it will wake up the phone or not, or whether this shall be at exact times or there is amouint if slip allowed). I also discovered that scheduled alarms not always survive phone reboot - but you can overcome it by registering BOTT_COMPLETE listener, which will reschedule your briadcasts on reboot.

I'm developing application which does this:

https://github.com/ko5tik/camerawatch

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top