I programmed an App for Android and got some trouble with my Service.
The following image may gives a better understanding of the situation. I tried to keep it as simple as possible:

I have an Activity that starts a service. This service starts a Thread which does a request to a Web page. As soon as this service is started, it should continue this procedure.
The only Exception is the low memory killer or human request from the activity.
My Problem now: In the moment where the Android-device activates its powersafe-mode (Screen turns black), the Thread is paused/halted. After i reactivate the device, the Thread resumes.
What I got so far:
- Using the emulator, all works fine (sending request even in power safe mode)
- Android-device connected to PC/Laptop (with and without debug mode), all works like it’s supposed to be
- Android device not connected to anything –> as soon as it goes to power safe mode, the Thread is pausing
- reactivating the device, the Thread continues (e.g. not destroyed of the low memory killer)
I hope you got an understanding of my problem and can help me. I can’t see the reason why it won’t work in the one special given situation.
Thanks in advance 🙂
Have a look to the PowerManagement class. But use it carefully because :