I have an Flutter app that shows data that are refreshed each hour.
Many users have requested a widget and I went on the task to fix it for Android and iOS.
My experience with Kotlin and Swift was "near zero", so a total noob. I need a more experience dev to give me a direction on how to handle Android.
Just finished up the widget in iOS and it was really neat and pretty easy to implement.
Apple had good guides and a clear how the widget data is handled and what to expect by the system regarding to background handling.
Now I am trying to create the same success on Android and I wanted to use "Glance" as this was the most modern design. Guides for implement data was OK and the state-handling was clear. But to update the widget each hour is pain:
- Workmanager is not triggered on the hour whole hour (can be delayed for minutes)
- Workmanager is not started when app starts (restart of phone makes your widget static, need a click to get it going again)
My resources for learning this was
- https://developer.android.com/jetpack/compose/glance/glance-app-widget
- https://dev.to/tkuenneth/updating-widgets-introduction-4cof
- https://github.com/android/user-interface-samples/blob/39741e7f101e397811815ab9c7d456ad00d099a7/AppWidget/app/src/main/java/com/example/android/appwidget/glance/weather/WeatherWorker.kt
Are there any "timeline" data handling in Android like iOS does? Or are all widgets based on a timer with highly restrictions, making the experience pretty lousy?