Thanks again mark for enlightening me :) But one more ques please.
I have registered [ACTION_BATTERY_CHANGED] programmatically in activity A1. I am able to get broadcast event for battery change in A1. Now from that A1 started a new activity A2. But I am not able to get these broad cast event in Activity A2. Why so? Many many thanks AJ On Mar 25, 2:26 pm, Mark Murphy <[email protected]> wrote: > AJ wrote: > > Hi group, > > > I added broadcast listener "BATTERY_CHANGED" to Android Manifest file > > so that when the status changed I should get informed. I am adding to > > Android Manifest file as I want it active through my application life > > time. > > > But the problem is that I am not getting the broad cast event from the > > system when battery status changes :( > > > My code is here :- > > > <receiver android:name=".MyBroadcastReceiver" android:enabled="true" > > android:permission="android.permission.BROADCAST_STICKY"> > > <intent-filter> > > <action > > android:name="android.intent.action.BATTERY_CHANGED" /> > > </intent-filter> > > </receiver> > > > <uses-permission android:name="android.permission.BATTERY_STATS"/> > > <uses-permission android:name="android.permission.BROADCAST_STICKY"/> > > > Can anybody please tell me what wrong I am doing here? > > "You can not receive [ACTION_BATTERY_CHANGED] through components > declared in manifests, only by explicitly registering for it with > Context.registerReceiver(). See ACTION_BATTERY_LOW, ACTION_BATTERY_OKAY, > ACTION_POWER_CONNECTED, and ACTION_POWER_DISCONNECTED for distinct > battery-related broadcasts that are sent and can be received through > manifest receivers. " > > (from the docs for Intent) > > So, you either need to register this from some existing component, or > switch to one of those other broadcast Intents. > > The rationale: Android does not want to start up a whole 'nuther process > just because the battery level changed. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > Android Development Wiki:http://wiki.andmob.org -- 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 To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

