查找这BroadcastReceivers注册? [英] Finding which BroadcastReceivers are registered?

查看:150
本文介绍了查找这BroadcastReceivers注册?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个程序,监视传入短信的,我想它来监视他们的专职,所以我与我创建了一个广播接收器registerReceiver。问题是,如果我想注销接收器,我不能,除非我知道我注册了原来的BroadcastReceiver类。这不是一个问题,如果我将它设置为阻止程序停止的时候,但我想接收器继续运行,只有当用户指定停止。

I have a program that monitors incoming SMS's, and I want it to monitor them full-time, so I registerReceiver with a Broadcast receiver that I've created. The problem is, if I want to unregister that receiver, I can't unless I know the original BroadcastReceiver class I registered. This is not a problem if I set it to stop when the program stops, but I want the receiver to keep running, only stopping when the user specifies.

编辑:或者是有保存,我已经创建了广播接收器类,这样当的onDestroy被称为它可以保存和创建时再次调用它可以拉出的方式

Or is there a way of "Storing" the BroadcastReceiver class that I've created, such that when onDestroy is called it can be saved and when create is called again it can be pulled out.

是否有这样做的方法吗?

Is there any way of doing this?

推荐答案

我不知道,但我觉得<一个href=\"http://developer.android.com/reference/android/content/pm/PackageManager.html#queryBroadcastReceivers(android.content.Intent,%20int)\"相对=nofollow>这个可以帮助你。但它会给你所有的注册名单
对于特定的意图接收机

I'm not sure, but I think this can help you. But it will give your list of all registered receivers for a particular Intent

这篇关于查找这BroadcastReceivers注册?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆