JulianAssmann / flutter_background

A flutter plugin to keep apps running in the background via foreground services. Android only.
https://pub.dev/packages/flutter_background
MIT License
86 stars 46 forks source link

Fix crash when calling FlutterPlugin.[initialize, hasPermissions] for the first time #12

Closed JulianAssmann closed 3 years ago

JulianAssmann commented 3 years ago

The bug was due to a call to result.success() when calling FlutterBackground.initialize() even if the app was still waiting for the user to ignore battery optimizations, allowing for subsequent calls to FlutterBackground.enableBackgroundExecution(), that failed because the battery optimizations were not granted at this time.