Skip to content

Unhandled Exception: PlatformException - WorkManager is not initialized properly #14

@mehmetalpsumer

Description

@mehmetalpsumer

Hello, thanks for the package.
I am trying to write data to Google's Firestore every x minutes let's say. I created App.kt and set it as android:name. And my main file is as the following:

void callbackDispatcher() {
  Workmanager.executeTask((backgroundTask) {
    Test.writeTestData();
    return Future.value(true);
  });
}

void main() {
  if (Platform.isAndroid) {
    Workmanager.initialize(
      callbackDispatcher, // The top level function, aka Flutter entry point
      isInDebugMode: true,
    );
    Workmanager.registerPeriodicTask("testSensor", "simplePeriodicTask", frequency: Duration(seconds: 10));
  }
  runApp(MyApp());
} 

And the error is:

Unhandled Exception: PlatformException(error, WorkManager is not initialized properly. You have explicitly disabled WorkManagerInitializer in your manifest, have not manually called WorkManager#initialize at this point, and your Application does not implement Configuration.Provider., null)

Cheers.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions