Can you manually fire ACTION_BATTERY_LOW?

2019-05-29 07:03发布

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.

2条回答
女痞
2楼-- · 2019-05-29 07:34

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."?

查看更多
Rolldiameter
3楼-- · 2019-05-29 07:49

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

查看更多
登录 后发表回答