Question Is there a way to enable some of the desktop widgets that I issue using my application programmatically? For example, having a "premium" widget and giving it access only after payment?
According to Android docs , you need to add the broadcast recipient to the manifest in order to tell the system that there is a widget that comes with the application
<receiver android:name="ExampleAppWidgetProvider" > <intent-filter> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> </intent-filter> <meta-data android:name="android.appwidget.provider" android:resource="@xml/example_appwidget_info" /> </receiver>
But theoretically, broadcast receivers can also be added programmatically, so that widgets can be registered later at runtime?
source share