register this receiver with application context.
That would solve ur problem.

second possible solution is that register receiver in manifest file.

Regards,
Srihari.R

On May 2, 1:06 pm, Omkar <[email protected]> wrote:
> Hi,
>     I have created a activity to show battery information when
> started, but I would preferably want to keep it constantly running in
> the background as a service and make a log of when the charging
> started, when it ended, how long the battery charge lasted etc etc.
> If I keep it in activity, user must run this app when charging is
> started, which isn't make it much useful. I am not sure how do I set
> my app to trigger automatically when charging is started, disconnected
> etc.
> Btw, I have created a broadcastreceiver for catching
> Intent.ACTION_BATTERY_CHANGED and its working fine, but only from the
> activity.
>
> Pls suggest what change should I be doing to my app, so that whenever
> there is a charging / discharging change thru charger plugin / usb
> plugin, my app shld log it in file.
>
> Thanks
> Omkar

-- 
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