PSIXO PSIXO - 3 months ago 6
Android Question

Receiver unregisterProblem

I am having the following problem in my app.
In on resume of my activity I register a broadcast receiver using this:

NetworkStateReceivernetworkStateReceiver = new NetworkStateReceiver(UIWrapperActivity.this);
filterConnectivity = new IntentFilter();
registerReceiver(networkStateReceiver, filterConnectivity);

And then in
I unregister it:


In broadcast receiver in the same activity I catch
and show a certain activity (Something like noConnection) switching to this activity does trigger
of first activity so receiver is unregistered but than when I try to close the noConnection activity using
it's just reopened and won't go away.

Does anyone know what am I doing wrong and why is my broadcast receiver not unregistered?


I eventually found out what I was doing wrong so if someone gets this same error, here is the solution. I didn't finish the activity when I caught intent broadcast in the receiver so keep an eye out for that because if activity is still alive then it calls it's onResume() again and receiver gets re-registered.