Ok, so if I let the intent Action_Power_Connected trigger my service by declaring this intent filter in the manifest and then let my service log the required data by creating a registerReceiver for the Action_Battery_Changed within the code, then I would be saved by not having the service constantly running. The 1st intent being an offline intent, would allow my app service to be triggered automatically thereby starting the service and then service would actually do its work and close itself after its work is done.. Is that ok ?
Thanks Omkar On May 3, 4:32 pm, Kostya Vasilyev <kmans...@gmail.com> wrote: > 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en