How to check if Receiver is registered in Android?

Mikey picture Mikey · Apr 21, 2010 · Viewed 136.4k times · Source

I need to check if my registered receiver is still registered if not how do i check it any methods?

Answer

Daniel picture Daniel · Aug 25, 2010

There is no API function to check if a receiver is registered. The workaround is to put your code in a try catch block as done below.

try {

 //Register or UnRegister your broadcast receiver here

} catch(IllegalArgumentException e) {

    e.printStackTrace();
}