简体   繁体   English

屏幕关闭时,Android BroadcastReceiver不起作用

[英]Android BroadcastReceiver does'nt work when screen is turned off

I have a BroadcastReceiver with ACTION_BATTERY_CHANGED. 我有一个带有ACTION_BATTERY_CHANGED的BroadcastReceiver。 I get events only when the screen is turned on. 我只有在打开屏幕时才能获得事件。

I want to get events of battery change even if the screen is turned off? 即使关闭了屏幕,我也想获得电池更换事件? How? 怎么样?

如果将接收器放在清单中,则它应该一直存在。

I would say that it is generally not great form to ask the same question multiple times. 我会说,多次问相同的问题通常不是很好的形式。 I answered this question, for you, here: 我在这里为您回答了这个问题:

Android keep BroadcastReceiver while the app is closed 在应用关闭时,Android保留BroadcastReceiver

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 屏幕关闭时,Android加速度计无法正常工作 - Android accelerometer not working when screen is turned off 屏幕关闭或锁定时,android broadcastreceiver? - android broadcastreceiver when screen off or lock? 当应用未运行时,在ANDROID中打开/关闭屏幕的BroadcastReceiver - BroadcastReceiver for Screen On/Off in ANDROID When App is not running 关闭设备然后再打开时,AlarmManager不起作用 - AlarmManager does not work when device turned off and then turned on Android-屏幕关闭或屏幕超时时终止应用 - Android - Kill an app when screen turned off or screen times out Android BroadcastReceiver 屏幕关闭前 - Android BroadcastReceiver Before Screen Off 为什么在屏幕关闭时,postAtTime不会在正确的时间触发 - Why does postAtTime not trigger at the right time when screen is turned off 屏幕关闭时调用Android onStart()事件 - Android onStart() event is called when the screen is turned off 是否可以在 JavaScript 中检测到 Android 和 iOS 浏览器中的屏幕何时关闭 - Is it possible, in JavaScript, to detect when the screen is turned off in the Android & iOS browsers 如何在Android 5.0 Lollipop中关闭屏幕固定时收到通知? - How to be notified when screen pinning is turned off in Android 5.0 Lollipop?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM