正如@hackbod此处所述,我使用onStart/onStop 夫妇绑定/取消绑定到我的服务。
我希望我的服务在锁定模式下停止运行(以节省电池)并在返回时恢复运行。但是,锁定模式可与 onResume/onPause 组合一起使用。那么我该怎么做呢?
谢谢
As @hackbod stated here, I used the onStart/onStop couple to bind/unbind to my service.
I want my service to stop running when in lock mode (to save battery) and to resume when coming back. However, Lock mode works with the onResume/onPause couple. So how do I do that?
Thanks
发布评论
评论(1)
您可以在屏幕开启/关闭。
You can listen for broadcast when the screen turns on/off.