i want to check how the service feature set in android works. to check it, i have a controller class that will start the service. in the service i have a handler that executes a function every minute.the function plays the sound. everything works well when the screen is on but after the screen goes dark(off), the sound is heard about 2-3 times (2-3 minutes) and then it stops... any idea why? and how can i make it (execute the sound function)work every minute?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
When the phone goes into sleep mode, so does the cpu. Some recievers may wake the phone up causing your sounds to be heard. Take a look into PowerManager and try to wake your phone(and cpu) up when you want to hear the sound.