Thanks everyone for your help.

My bad.  I do register in the body of the program instead of in the
manifest.  So, scratch the part above about the manifest.

I declare a static variable in the activity to keep track of whether
or not the registration has already happened.  Perhaps the receiver is
being de-registered while the static boolean reference is kept alive
in the VM:



public MyActivity extends Activity {

    private static boolean registeredBatteryIntent = false;

 @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (!registeredBatteryIntent){

                IntentFilter filter = new IntentFilter
(Intent.ACTION_BATTERY_CHANGED);
                MyReceiver receiver = new MyReceiver();
                this.registerReceiver(receiver, filter);
                Log.i("Receiver.Registration", "registered intent
receiver.");
                registeredBatteryIntent = true;


        }
    }
}

Richard

On Jul 14, 10:31 am, Mark Murphy <[email protected]> wrote:
> Richard Schilling wrote:
> > That's a good point.  I will try registering the broadcast receiver
> > programmatically as well to see if there's a difference in behavior.
>
> The docs say you need to register BATTERY_CHANGED receivers in code, not
> via the manifest.
>
> "You can not receive this through components declared in manifests, only
> by exlicitly [sic] registering for it with Context.registerReceiver(). "
>
> http://developer.android.com/reference/android/content/Intent.html#AC...
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Need help for your Android OSS project?http://wiki.andmob.org/hado
--~--~---------~--~----~------------~-------~--~----~
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