'How to use WorkManager with Glance composable?
In the the below medium article written by a Google Android Engineer, it states that the best way to fetch data in a glance widget is to use WorkManager
.
The best way to fetch data asynchronously from the background is by using WorkManager and storing the data as recommended in the Guide to background work. The important part is to avoid launching new workers either consecutively (for example, inside GlanceAppWidgetReceiver.onUpdate) or when data is already loaded.
So how do you use WorkManager
inside the content()
function of GlanceAppWidget()
? Can someone please provide a working example?
https://medium.com/androiddevelopers/demystifying-jetpack-glance-for-app-widgets-8fbc7041955c
Solution 1:[1]
No official example yet, check this demo from Piotr
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Marcel |