简体   繁体   English

关闭屏幕后保持应用程序处于活动状态

[英]Keep application active after the screen is turned off

I have a receiver in my app (public class SMSReceiver extends BroadcastReceiver) which works just fine - except when the screen turns off. 我的应用程序中有一个接收器(公共类SMSReceiver扩展了BroadcastReceiver),该接收器工作得很好-除非屏幕关闭。 After the screen has turned off, the receiver stops receiving SMSes. 屏幕关闭后,接收器停止接收SMS。 Is there any way to solved this? 有什么办法解决这个问题吗?

I would say that you will have to start a service that will listen for these Broadcasts. 我要说的是,您将必须启动将监听这些广播的服务。 this is what I am doing while listening for ON_TIMETICK, SCREEN_OFF, and SCREEN_ON. 这是我在监听ON_TIMETICK,SCREEN_OFF和SCREEN_ON时所做的事情。 I could not get it to work any other way. 我无法使它以任何其他方式工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM