onPause 锁屏和来电的区别
我正在开发一个音频应用程序。它在后台播放声音,我希望它在来电时关闭,但在屏幕锁定时不关闭。 我的第一次机会是在 onPause 上调用player.stop(),因为我认为当传入或其他应用程序在上面运行时它会起作用。 但我发现屏幕锁定也会调用这个 onPause 事件。
有机会了解该电话的原因吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信这篇文章有您正在寻找的内容:
http://thinkandroid.wordpress。 com/2010/01/24/handling-screen-off-and-screen-on-intents/
有一些代码片段解释了如何处理屏幕关闭等问题。
希望对一些人有所帮助!
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!