I encoded my second Android application, which switches audio profiles based on a specific schedule (date and time only as of the moment) .... the code works without any problems if I run the code using an emulator via eclipse ... when I recently exported apk and installed it on my Samsung Galaxy S2 and added the same profile graph as the emulator, but for some odd reason, the timertask does not execute after the first time ...
For example: Here is the profile schedule from my phone, as well as with the emulator:
8AM - 5:30 PM - Work
5:30 pm - 10 pm - Home
10 pm - 8 am - sleep
as soon as it is planned, and I press the activation button in the main action. The background service starts switching from one profile to the next until it is deactivated ...
The only difference that I noticed between the emulator and my phone is that the emulator screen never turns off ... so I think the emulator does not sleep at all? while my phone screen turns off after about 30 seconds of inactivity, in addition to the lock screen ... In addition, I turned on USB debugging on the phone and connected it directly to the computer and from what it seemed, the code was execution, switching one profile to the next, to my phone without any problems ... (Please note that when I did this testing, I used shorter time intervals in the profile graphs) ... Additional information: I also added startForeground () to my service code and make sure the service does not end ...
- , , , ?... , , , : Android PowerManager...