Short version: does Android reboot the phone (literally reboot) to get rid of foreground services? If so, in what cases?
Long version: I wrote a GPS service which registers itself as a foreground service (in this case this is a good idea – when I run it, it is the single most important thing on my phone 😉 ). While testing, this service is a big resource consumer – it gets GPS data every second and writes to SQLite DB file on SD card. Later I will use internal memory and make poll times longer, but I need the test data for now.
The service works as intended. I have created an Activity that starts & stops it and the results look fine. But when I kept it running the phone rebooted itself after some time (half an hour or so). Since I never noticed this in normal usage, I am attributing this to my service. However, I have no idea what is causing this – should I request a wakelock for CPU? (if this is the problem, wouldn’t phone just shutdown?) Did I run out of memory? Did I use too much battery? (it was half full) Is there a log where I can check why the phone rebooted?
Environment: Xperia X10, Android 2.3.3.
AFAIK, no. That would be unduly harsh to the user. There is nothing about a foreground service that somehow prevents the OS from terminating its process like any other.
My guess is that you are tripping over some firmware bug with your device.