views:

43

answers:

1

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.

EDIT: 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?

A: 

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

[1]: http://developer.android.com/reference/android/content/pm/PackageManager.html#queryBroadcastReceivers(android.content.Intent, int)

Nikolay Ivanov