Well.. I'm sorry if I misunderstood what you said, but I register my
broadcast receive in my app2.

In my APP2 I have:

*//APP2*
String myAction = ..;
IntentFilter filter = new IntentFilter();
filter.addAction(myAction);
this.registerReceiver(receiver, filter); //<--this line right here


where my receiver is defined as:
*//APP2
private BroadcastReceiver receiver= new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {
        Log.w(TAG,"intent received");
    }
};


*In fact, when I try to start my activity (my class the has my receiver)
like this:

*//APP1
Intent intent = new Intent();
intent.setComponent(new ComponentName(pkgApp2, clsApp2));
startActivity(intent);*

it works very well.




2011/5/9 Mark Murphy <mmur...@commonsware.com>

> On Mon, May 9, 2011 at 9:00 AM, Paula Gabriela <paul...@gmail.com> wrote:
> > Hello everyone,
> >
> > I have a problem when I try to send a broadcast intent from App1 to App2
> and
> > set my component name using setComponent() method
> >
> > That is,
> >
> > In my APP2 I have
> > String myAction = ..;
> > IntentFilter filter = new IntentFilter();
> > filter.addAction(myAction);
> > this.registerReceiver(receiver, filter);
> >
> >
> > //APP1
> >
> > String myAction = ..;
> > Intent intent = new Intent(myAction);
> > sendBroadcast(intent);
> >
> > it works, but if I use
> >
> > String myAction = ..;
> > Intent intent = new Intent(myAction);
> > intent.setComponent(new ComponentName(pkgApp2, clsApp2));
> > sendBroadcast(intent);
> >
> > It doesn't works. So my question is: why?
>
> Because there is no BroadcastReceiver with your designated package and
> class.
>
> --
> 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

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