flutter_workmanager icon indicating copy to clipboard operation
flutter_workmanager copied to clipboard

Can I use it to implement the reload timeline for iOS widgets?

Open GanZhiXiong opened this issue 1 year ago • 7 comments

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

GanZhiXiong avatar Jan 09 '24 09:01 GanZhiXiong

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.

alexbejann avatar Apr 17 '24 15:04 alexbejann

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 avatar Jul 21 '24 23:07 Shatha-Naami

@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.

GanZhiXiong avatar Jul 21 '24 23:07 GanZhiXiong

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

Shatha-Naami avatar Jul 21 '24 23:07 Shatha-Naami

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.

GanZhiXiong avatar Jul 21 '24 23:07 GanZhiXiong

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 avatar Aug 08 '24 07:08 Shatha-Naami

@Shatha-Naami
Great, thank you for sharing. The article is very detailed, I will read it carefully when I have time.

GanZhiXiong avatar Aug 08 '24 15:08 GanZhiXiong