receiver enabled=false , problems after instantiation to set to listen

by Jiri » Wed, 12 Aug 2009 18:09:11 GMT


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



--~--~---------~--~----~------------~-------~--~----~



receiver enabled=false , problems after instantiation to set to listen

by Jiri » Thu, 13 Aug 2009 15:48:39 GMT


 > If you don't want android instantiating a component, there is no reason
 > to declare it in a manifest.

Thank you for the clear answer.

And yes it should have been

 >ComponentName("org.dadata.demo",".model.Dots");

Jiri





--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


receiver enabled=false , problems after instantiation to set to listen

by Jiri » Thu, 13 Aug 2009 16:23:48 GMT


 One more question. In my Activity.onDraw method I have this:

Dots dotModel = new Dots();

IntentFilter iFilter = new IntentFilter();
iFilter.addAction("org.dadata.demo.ON_UPDATE");
this.registerReceiver(dotModel, iFilter);

Then later in a click handler I wrote this:

Intent intent = new Intent();
intent.setAction("org.dadata.demo.ON_UPDATE");
getApplicationContext().sendBroadcast(intent);

Is there some way to externalise the now hardcoded string:
"org.dadata.demo.ON_UPDATE" so i can access it from anywhere and 
reducing the risk of typed errors?

Jiri






--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. HTTP module missing

Hi,
We are planning to use the Android for one of our device.

Is there any HTP layer implementation in Android SDK V 1.1?
While going through the code  I am not able to find any "HTTP" layer
implementation for communication.
Here in website , in Package index it is giving the Interfaces and
classes of HTTP layer.
But I am not able to find any of these interfaces in the SDK V 1.1
provided for download in the "SDK" secion.
Please share your idea in this and help me to  solve this .

Thank you very much in advance,
With regards,
Geetha
--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

2. Merging spannables?

Is it possible to merge spannables?

like
Spannable spa = null;
spa = Html.fromHtml("text text <b> asds</b>");

spa = spa + Html.fromHtml("asdasdasd");

Thanks

--~--~---------~--~----~------------~-------~--~----~

3. Emulator doesn't link sometimes

4. Kernel Build Failure for FreeRunner

5. read cookie value which is set by website browsed in emulator browser

6. problem occur while writing android.provider.Settings.Secu颅re.ENABLED_INPUT_METHODS

7. Is it normal to play an audio during phone call?