I want to generate a low battery alert programmatically, same as that will be generated when battery is low..can any one post a sample code how to do it..am aware of ACTION_BATTERY_LOW. but how to use it..? i want to generate a low battery alert even though battery is not low.
Asked
Active
Viewed 4,158 times
3
-
Possible duplicate: http://stackoverflow.com/questions/16295196/how-to-simulate-low-battery-in-android-devices – AlikElzin-kilaka Jul 15 '13 at 13:07
2 Answers
3
ACTION_BATTERY_LOW
is a system's broadcast action, so you won't be able to generate it for security reasons - at least not on a "regular" device

DonGru
- 13,532
- 8
- 45
- 55
-
-
I don't exactly know what you're trying to do - but if it's just about raising an alarm you could use ACTION_BATTERY_CHANGED to monitor the battery state and if it drops under a defined value you can show a custom low-battery-dialogue – DonGru Sep 09 '10 at 11:38
2

dorin
- 873
- 2
- 15
- 34
-
Link doesn't answer the question; but, is a nice brief example of reading battery level. – donfede Jan 26 '13 at 04:40