On Fri, Jul 8, 2011 at 5:26 PM, Steven Bruce <stevebruc...@gmail.com> wrote:
> Thanks a lot. That worked a treat. I have since changed my code so
> I've now dynamically created a BroadcastReceiver in my main class
> (using registerReceiver) instead of the manifest file as its more
> accessible to my BluetoothTest activity. Having it locked away in a
> seperate class seemed very obstructive and unintitive. Any thoughts on
> this?

You register a BroadcastReceiver via registerReceiver() when you are
forced to (e.g., ACTION_BATTERY_CHANGED), or when you only want to
receive the broadcast while the registering component exists (e.g.,
while your activity is in the foreground).

You register a BroadcastReceiver via the manifest when you are forced
to (e.g., ACTION_BOOT_COMPLETED), or when you want to receive the
broadcast even if no other component of your application is running.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training...At Your Office: http://commonsware.com/training

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

Reply via email to