Can you manually fire ACTION_BATTERY_LOW?

大兔子大兔子 提交于 2019-12-10 11:37:05

问题


I'm relatively new to android programming but I'm told most applications have a receiver that will cut down on battery expensive activities when android fires ACTION_BATTERY_LOW.

Android developing page says: public static final String ACTION_BATTERY_LOW

Added in API level 1 Broadcast Action: Indicates low battery condition on the device. This broadcast corresponds to the "Low battery warning" system dialog.

This is a protected intent that can only be sent by the system.

Constant Value: "android.intent.action.BATTERY_LOW"

I was wondering if there was a way to send this intent manually, at any desired battery level. I have a rooted device if that makes a difference.


回答1:


No. It's not possible. Check this post. Look into the answer given by Mark(commonsware).




回答2:


Sure there is a way to change the level - just download the terabytes of complete source code and spend a week or two building your own custom ROM, and trying to flash it without bricking your phone. It will only work on your device.

But no, you cannot change it in an app, nor on anyone else's device, and you cannot fire it yourself - did you read the part you quoted, "This is a protected intent that can only be sent by the system."?



来源:https://stackoverflow.com/questions/26654844/can-you-manually-fire-action-battery-low

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!