Activity has leaked IntentReceiver that was originally registered here. Are you missing a call to unregisterReceiver()?

Solution 1:

Don't rely on onStop(), because:

Note that this method may never be called, in low memory situations where the system does not have enough memory to keep your activity's process running after its onPause() method is called

More on Activity life cycle here.

Unregister your receiver in onPause():

@Override
protected void onPause() {
    super.onPause();

    unregisterReceiver(yourReceiver);
}

Solution 2:

You need to unregister your receivers on stop of your activity:

@Override
protected void onStop()
{
    unregisterReceiver(yourReceiver);
    super.onStop();
}

Solution 3:

You can unregister as soon as you receive the broadcastreceiver

 @Override
 public void onReceive(Context context, Intent intent) {
     getActivity().unregisterReceiver(this);
 }

Solution 4:

Just to add to the answers above, if you register a receiver in on onCreate, it should be unregistered in onDestroy. if you register a receiver on onResume, you should unregister it in onPause.

Be mindful of where you register and unregister the receiver, for example, if you register a receiver in onCreate(Bundle) using the activity's context, you should unregister it in onDestroy() to prevent leaking the receiver out of the activity context. If you register a receiver in onResume(), you should unregister it in onPause() to prevent registering it multiple times (If you don't want to receive broadcasts when paused, and this can cut down on unnecessary system overhead). Do not unregister in onSaveInstanceState(Bundle), because this isn't called if the user moves back in the history stack.

Source

Solution 5:

Unregister your receiver on onStop() is the valid answer. Do not call it on onPause() method.

@Override
protected void onStop()
{
    unregisterReceiver(yourReceiverName);
    super.onStop();
}