tags:

views:

92

answers:

1

Hi everyone,

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.

+1  A: 

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

Martin
Then is there is any other way to generate low battery alert Martin?
Sridhar Bandi
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
Martin