When building the ComponentName, you need to reference the correct
BroadcastReceiver.  In your case, it looks like you're enabling
"org.dadata.demo.Dots", when the <receiver> is over in the ".model."
subpackage.

You can also create more robust ComponentNames by using the (Context,
Class) constructor, instead of relying on strings:

new ComponentName(context, DotsReceiver.class);

j


On Wed, Aug 12, 2009 at 3:08 AM, Jiri<[email protected]> wrote:
>
> Hello List,
>
> in my manifest I set an custom object Dots that extends a
> BroadcastReceiver to receive a certain broadcast string.
>
> <receiver
> android:name=".model.Dots"
> android:enabled="false">
> <intent-filter >
> <action android:name="org.dadata.demo.receiverTest" />
> </intent-filter>
> </receiver>
>
> I dont want Android to instantiate the object for me hence the enable=false.
>
> In the Activity a new Dots is created
>
> Dots dots = new Dots()
>
> How do i now make the Dots start listening to the broadcasting. I tried
> this, but it doesnt work and it also feels much to complicated..
>
> ComponentName cName = new
> ComponentName("org.dadata.demo","org.dadata.demo.Dots");
> PackageManager pm = this.getPackageManager();
> pm.setComponentEnabledSetting(cName ,
> PackageManager.COMPONENT_ENABLED_STATE_ENABLED ,
> PackageManager.DONT_KILL_APP);
>
> Is there a workable easy way to do this?
>
> Thank you,
>
> Jiri
>
>
>
> >
>



-- 
Jeff Sharkey
[email protected]

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