Activity has leaked IntentReceiver ScreenReceiver that was originally registered here. Are you missing a call to unregisterReceiver()?
in my main activity
// Register receiver that handles screen on and screen off logic final IntentFilter intentScreenfilter = new IntentFilter(Intent.ACTION_SCREEN_ON); intentScreenfilter.addAction(Intent.ACTION_SCREEN_OFF); intentScreenfilter.addAction(Intent.ACTION_USER_PRESENT); screenReceiver = new ScreenReceiver();
and when the application is closed, I get this message.
ACTION_SCREEN_OFF
AND
ACTION_SCREEN_ON
cannot be registered in AndroidManifest, but only programmatically. What can I do? I do not want to use the Service, because if the service is running all day, it is not good for the battery. What is the solution? How to use these receivers?
source share