The online android documentation says:
Everything you can do with AppWidgetProvider, you can do with a regular BroadcastReceiver.
So, what i want to do is to register via registerReceiver()
another event other than ACTION_APPWIDGET_*
on my Widget. For example ACTION_BATTERY_OKAY
, is there any way to do this? Obviously i cant register the event from the onUpdate()
code but i should 开发者_如何学编程do it using a service or something else. The problem is that im not able to find any reference to the Provider (AppWidgetManager only returns AppWidgetProviderInfo objects).
Any idea?
i think you would want to define your ACTION_BATTERY_OKAY intent filter in your AndroidManifest.xml and then override the onReceive and be sure to call super.onReceive to handle the appwidget dispatching.
精彩评论