You cannot receive ACTION_BATTERY_CHARGED through a receiver declared in the manifest.

Registering a receiver with the Application context doesn't help if the process gets killed.

The battery action is a sticky broadcast, so you can get the most recent value by calling registerReceiver with a null receiver at any time, perhaps driven by AlarmManager.

-- Kostya

03.05.2011 15:12, Omkar пишет:
By registering the receiver in either app context / manifest file,
would I be saved from not having constantly run my service in
background ? Bcos I also know that charging / discharging thru usb /
power supply would occur once a day or may once in 2 days and it
doesn't make sense to keep a constantly monitoring when the phone is
connected for charging / disconnected from charger. If something lets
my service know that charger has been connected / disconnected, within
my OnReceive, I can check what intent.getAction it is and then take a
correct action accordingly.

Pls suggest.
Thanks
Omkar



--
Kostya Vasilyev -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to