Created
November 17, 2020 21:37
-
-
Save waliahimanshu/6e95695477dfdba345dd9ff021f7e452 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WidgetUpdateNotifierImpl : WidgetUpdateNotifier { | |
override fun refreshWidget(context: Context) { | |
val intent = Intent(context, YourWidgetClassName::class.java) | |
intent.action = AppWidgetManager.ACTION_APPWIDGET_UPDATE | |
val componentName = ComponentName(context, YourWidgetClassName::class.java) | |
val ids: IntArray = AppWidgetManager.getInstance(context).getAppWidgetIds(componentName) | |
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids) | |
context.sendBroadcast(intent) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment