c0dehunter
c0dehunter

Reputation: 6150

How can WorkManager be used for widget updating?

Android Oreo (8.0) makes it very hard to update widgets (1,2,3) either by clicking a button (PendingIntent) or automatically updating every X minutes. I am looking into how I could use the new WorkManager for this.

I was able to use if for another task not related to widgets, and it works well. However, I can't find any example (or even a quick outline) on how to use it with widgets to be able to update them periodically (let's say every 5 minutes) and also update them when a RemoteView is clicked. BTW, this requires downloading a file from the internet and displaying contents in RemoteViews.

Has anyone tried it and how did it work out? Are there any examples?

Upvotes: 2

Views: 2367

Answers (1)

Rahul
Rahul

Reputation: 21124

You can use WorkManager which scheduler your Workers using JobScheduler. There is nothing special about a Widget in Android O which makes things different (from WorkManagers perspective).

Upvotes: 1

Related Questions