android sound gets disabled after sometime

自闭症网瘾萝莉.ら 提交于 2019-12-25 08:49:19

问题


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.



来源:https://stackoverflow.com/questions/5280951/android-sound-gets-disabled-after-sometime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!