On Fri, Jul 23, 2010 at 1:42 PM, Jin Chiu <live2drea...@gmail.com> wrote: > Whenever I invoked `sendBroadcast()` using an intent with Component > name set, it does not get properly delivered to the destination's > broadcast receiver.
It has worked for me. > As an example, assume that I have a TargetActivity that registered a > BroadcastReceiver for ACTION1 > > This will work: > > Intent i = new Intent(TargetActivity.ACTION1); > sendBroadcast(i); > > > This does not: > > Intent i = new Intent(TargetActivity.ACTION1); > i.setClassName(this, TargetActivity.class); > sendBroadcast(i); > > I also tried i.setClass() with no luck. Is this behavior expected? In this case, sure. Your BroadcastReceiver is not TargetActivity. If you tell the Intent to go to TargetActivity, and that is not your BroadcastReceiver, it will not work. setClassName() tells Android to ignore the action string. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 2.9 Available! -- 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