Slide 30
Slide 30 text
© ZOZO, Inc.
更新のメカニズムをWorkManagerに移行
internal suspend fun update(
context: Context,
appWidgetId: Int,
options: Bundle? = null,
) {
Tracing.beginGlanceAppWidgetUpdate()
val glanceId = AppWidgetId(appWidgetId)
if (!sessionManager.isSessionRunning(context, glanceId.toSessionKey())) {
sessionManager.startSession(context, AppWidgetSession(this, glanceId, options))
} else {
val session = sessionManager.getSession(glanceId.toSessionKey()) as AppWidgetSession
session.updateGlance()
}
}
30
GlanceAppWidget.kt
引用 : https://android.googlesource.com/platform/frameworks/support/+/bd66997874293bcf20cfaf6e7d20633d15cefb62/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/GlanceAppWidget.kt