I need to check if my registered receiver is still registered if not how do i check it any methods?
I am not sure the API provides directly an API, if you consider this thread:
I was wondering the same thing.
In my case I have a
BroadcastReceiverimplementation that calls
Context#unregisterReceiver(BroadcastReceiver)passing itself as the arg after handling the Intent that it receives.
There is a small chance that the receiver's
onReceive(Context, Intent)method is called more than once, since it is registered with multiple
IntentFilters, creating the potential for an
IllegalArgumentExceptionbeing thrown from
In my case I can store a private synchronized member to check before calling
Context#unregisterReceiver(BroadcastReceiver), but it would be much cleaner if the API provided a check method.