WidgetLocker onResume onPause
我正在开发一个严重依赖加速计的 Android 应用程序。因此,我确实需要确保正确处理 onResume 和 onPause 事件。
当 WidgetLocker 被禁用时,我的应用程序工作正常,但是当我锁定屏幕并在启用 WidgetLocker 时返回到应用程序后,应用程序冻结,我必须在它再次响应之前终止该进程。
我的假设是 onPause 或 onResume 事件之一未运行,因此加速度计被注册两次或取消注册两次。
有没有办法确保事件会被命中,或者在没有命中的情况下进行编程?我对其他应用程序和 WidgetLocker 没有遇到任何问题,所以我认为我做错了什么。
I am developing an Android application that relies heavily on the accelerometer. Because of this, I really need to make sure that the onResume and onPause events are handled correctly.
My application works perfectly when WidgetLocker is disabled, but after I lock the screen and return to the application when WidgetLocker is enabled, the application freezes, and I have to kill the process before it responds again.
My assumption is that one of the events, onPause, or onResume is not being run so the accelerometer is being registered twice, or unregistered twice.
Is there a way to make sure that the events will be hit, or program for a case when they are not hit? I have not had any trouble with other application and WidgetLocker, so I assume that I am doing something wrong.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没有做错什么。
还有其他记录的 WidgetLocker 问题案例。对于开发,我只是禁用锁屏。上述问题与硬件相关并且由锁屏引起。当我玩很多游戏(一些专业游戏)时,我的手机(HTC EVO Design 4g)上也存在类似的问题。
I was doing nothing wrong.
There are other documented cases of issues with WidgetLocker. For development I just disable the lockscreen. The issue described above is hardware dependent and caused by the lockscreen. Similar issues exist on my phone (HTC EVO Design 4g) when I'm playing numerous games, some professional.