When to unregister BroadcastReceiver? In onPause(), onDestroy(), or onStop()?
问题 When should I use unregisterReceiver? In onPause() , onDestroy() , or onStop() ? Note: I need the service to run in the background. Update: I get an exception releasing receivers null . Activity has leaked intent receivers are you missing call to unregisterReceiver(); Please tell me if there's something wrong, here's my code: private boolean processedObstacleReceiverStarted; private boolean mainNotificationReceiverStarted; protected void onResume() { super.onResume(); try { registerReceivers(