简体   繁体   English

手动终止应用程序时如何获取广播接收器?

[英]How to get broadcast receiver when an app is killed manually?

I am developing an app which records unlocks of mobile.我正在开发一个记录手机解锁的应用程序。 But I am having problem when my app is manually killed ie when you remove app from recent apps.但是当我的应用程序被手动终止时我遇到了问题,即当您从最近的应用程序中删除应用程序时。 How can i record broadcast even when app is killed?即使应用程序被杀死,我如何录制广播?

I am using ACTION_USER_PRESENT for recording unlocks.我正在使用 ACTION_USER_PRESENT 来记录解锁。

You'll need to create a Service and inside this service create the broadcast receiver that you need.您需要创建一个Service ,并在此服务中创建您需要的广播接收器。

This answer Certainly will help you: Implement Broadcast receiver inside a Service这个答案当然会帮助你: Implement Broadcast receiver inside a Service

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

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