onPause difference between screen lock and incoming call

∥☆過路亽.° 提交于 2019-12-13 18:33:07

问题


I'm developing an audio application. It plays sounds in the background and I want it to turn off when an incoming call happens but not when the screen locks. My first chance was to call player.stop() on onPause as I thought it will do the trick when incoming or other applications will run on top. But I found that screen lock calls also this onPause event.

Is there any chance to get the cause of that calling?


回答1:


I believe this article has what you are looking for: http://thinkandroid.wordpress.com/2010/01/24/handling-screen-off-and-screen-on-intents/

Has some snippets of code explaining how to handle if the screen turns off etc.

Hope that helps some!



来源:https://stackoverflow.com/questions/4087426/onpause-difference-between-screen-lock-and-incoming-call

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