4
Activity has leaked IntentReceiver ScreenReceiver that was originally registered here. Are you missing a call to unregisterReceiver()?
在主要活動
我的Android Intent.ACTION_SCREEN_OFF和Intent.ACTION_USER_PRESENT如何註冊
// 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();
,當應用程序被關閉,我得到這個消息。
ACTION_SCREEN_OFF
和
ACTION_SCREEN_ON
不能註冊在AndroidManifest但只是編程。我能做什麼?我不想使用服務,因爲如果服務一整天都在運行,這對電池並不好。解決辦法是什麼?如何使用這個接收器?
呵呵但是這是不好的表現是不是? – senzacionale
是的,它對性能不利,運行服務會消耗更多電量。即使我是在這些接收器的基礎上開發應用程序,並檢查了所有可能性,但沒有出現。 – Naga
感謝您的幫助。如果這是唯一的可能性,我會採取它:D。 – senzacionale