GlanceAppWidgetReceiver
abstract class GlanceAppWidgetReceiver : AppWidgetProvider()
AppWidgetProvider
using the given GlanceAppWidget
to generate the remote views when needed.
This should typically used as: class MyGlanceAppWidgetProvider : GlanceAppWidgetProvider() { override val glanceAppWidget: GlanceAppWidget() get() = MyGlanceAppWidget() }
Note: If you override any of the AppWidgetProvider
methods, ensure you call their super-class
implementation.
Important: if you override any of the methods of this class, you must call the super
implementation, and you must not call AppWidgetProvider.goAsync
, as it will be called by the
super implementation. This means your processing time must be short.
Properties
abstract val glanceAppWidget: GlanceAppWidget
Instance of the GlanceAppWidget
to use to generate the App Widget and send it to the
AppWidgetManager
@get:ExperimentalGlanceApi
@ExperimentalGlanceApi
open val coroutineContext: CoroutineContext
Override coroutineContext
to provide custom CoroutineContext
in which to run update
requests.
Note: This does not set the CoroutineContext
for the GlanceAppWidget, which will always run
on the main thread.
Companion Object
Properties
const val ACTION_DEBUG_UPDATE = "androidx.glance.appwidget.action.DEBUG_UPDATE"
Action for a broadcast intent that will try to update all instances of a Glance App Widget for debugging.
adb shell am broadcast -a androidx.glance.appwidget.action.DEBUG_UPDATE -n APP/COMPONENT
where APP/COMPONENT is the manifest component for the GlanceAppWidgetReceiver subclass. This only works if the Receiver is exported (or the target device has adb running as root), and has androidx.glance.appwidget.DEBUG_UPDATE in its intent-filter. This should only be done for debug builds and disabled for release.