Question

The Android widget documentation (http://developer.android.com/guide/topics/appwidgets/index.html#AppWidgetProvider) seems to indicate that you can set your own broadcast receiver to handle widget activity instead of using the AppWidgetProvider helper class. For reasons of activity/service structure this would be the most convenient way for me to manage the widget I would like to create.

Is it possible to do this with a broadcast receiver registered in OnCreate as opposed to on in it's own class. The trouble, I think, is that it then isn't registered in the manifest, and thus the widget never shows up in the list.

Documentation/examples of this setup are essentially non-existent. Does anyone know if this is possible or have a good example?

Was it helpful?

Solution

Is it possible to do this with a broadcast receiver registered in OnCreate as opposed to on in it's own class.

Not really. In theory, you could have two receivers registered, one in the manifest and one via registerReceiver(). I cannot imagine a scenario in which this would be a good idea, as your activity will not be running all of the time anyway, and so you need the manifest-registered receiver to do everything anyhow.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top