flutter_workmanager
flutter_workmanager copied to clipboard
Can I use it to implement the reload timeline for iOS widgets?
This is a great plugin.
Requirement
Implement a widget that supports Android and iOS. I want to use it and flutter_workmanager to request the HTTP interface to update the data on the widget every 15 minutes.
https://github.com/ABausG/home_widget/issues/202
Hey @GanZhiXiong, Your request seems a bit outside the scope of this package. You can achieve what you're asking for by using a simple Provider/Cubit or any other state management solution (up to you) in combination with workmanager.
Hi @GanZhiXiong,
I have a similar task with an iOS widget that needs to be updated every 15 minutes, even when the app is in the background or terminated. The data for the widget is fetched from an API. Have you been able to achieve this functionality yet?
@Shatha-Naami If it is iOS, it cannot be achieved through this plugin. Finally, I implemented it through native. Android should be able to do it, but I haven't tried it.
Great! Once you've implemented the feature natively, do you use a method channel for integration? If you have any examples to share, that would be very helpful.
Thanks
Without using method channels for integration, the data needed by the widget can be stored in flutter through the shared_preferences | Flutter package, such as storing the token after switching accounts for native use.
This solution may not be the best. If you finally implement it, I look forward to your sharing.
Hi @GanZhiXiong,
I implemented the same task at my work and created a new article on this subject. Take a look, and be careful when you start setting up, especially with the background fetch package on the iOS side.
@Shatha-Naami
Great, thank you for sharing.
The article is very detailed, I will read it carefully when I have time.