So I have an issue where my existing Flutter Workmanager background task is not updating automatically following the app's update.
I have the example code which sets up a periodic Workmanager job.
void main() async
{
WidgetsFlutterBinding.ensureInitialized();
Workmanager().initialize(
callbackDispatcher
);
await Workmanager().registerPeriodicTask(
"ExampleTask",
"ExampleTaskPeriodicTask",
initialDelay: Duration(minutes: 15,
frequency: Duration(hours: 1)
);
}
void callbackDispatcher() async
{
Workmanager().executeTask((task, inputData) async
{
await DoSomething();
return Future.value(true);
});
}
If I update DoSomething() in my background task, currently it does not update for the user and it would continue doing the old thing, not the new thing.
Is there any way to update the background task without the user having to do anything following the apps automatic update?