Skip to content

Instantly share code, notes, and snippets.

@waliahimanshu
Last active November 18, 2020 16:38
Show Gist options
  • Save waliahimanshu/49cf8341f78802a59ac4de01c1e983b9 to your computer and use it in GitHub Desktop.
Save waliahimanshu/49cf8341f78802a59ac4de01c1e983b9 to your computer and use it in GitHub Desktop.
private val appWidgetManager = AppWidgetManager.getInstance(context)
private val provider = ComponentName(context, YourAppWidget::class.java)
private val allWidgetIds = appWidgetManager.getAppWidgetIds(provider)
fun updateWigetView(type: ViewStateType) {
allWidgetIds.forEach { widgetId ->
appWidgetManager.updateAppWidget(widgetId, remoteViews)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment