开发者

onPause difference between screen lock and incoming call

开发者 https://www.devze.com 2023-01-23 12:35 出处:网络
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.

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?


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!

0

精彩评论

暂无评论...
验证码 换一张
取 消