Comments (3)
Note: This happens only on VSCode.
Android Studio starts the app (but my task is never triggered).
Continuing after the first error:
Exception has occurred.
PlatformException (PlatformException(1, You have not properly initialized the Flutter WorkManager Package. You should ensure you have called the 'initialize' function first! Example:
`Workmanager.initialize(
callbackDispatcher,
)`
The `callbackDispatcher` is a top level function. See example in repository., null))
BTW, I've inserted this on my App.kt file: Log.d("WorkmanagerPlugin", "WorkmanagerPlugin is initializing")
and this log appears on catlog when the app is initialized (before Flutter first frame is rendered and the bug manifests itself).
After running a couple of times (and moving this initialization first thing in my flutter main), the first error doesn't occur anymore, but the second remains:
I also have to write this: WidgetsFlutterBinding.ensureInitialized();
, otherwise, my app says:
Exception has occurred.
FlutterError (ServicesBinding.defaultBinaryMessenger was accessed before the binding was initialized.
If you're running an application and need to access the binary messenger before `runApp()` has been called (for example, during plugin initialization), then you need to explicitly call the `WidgetsFlutterBinding.ensureInitialized()` first.
If you're running a test, you can call the `TestWidgetsFlutterBinding.ensureInitialized()` as the first line in your test's `main()` method to initialize the binding.)
from flutter_workmanager.
Is your callbackDispatcher a top level function?
Can you provide me with a sample that demonstrates this behaviour?
from flutter_workmanager.
That was the problem. Moving the function to public and outside the class made it work.
from flutter_workmanager.
Related Issues (20)
- How do I register plugins on Android ? HOT 2
- Is the flutter work manager still work even if app killed from background?
- 🐞 onNetworkChanged() not implemented in androidx.work.impl.background.systemjob.SystemJobService. Must override in a subclass. HOT 1
- Can I use it to implement the reload timeline for iOS widgets? HOT 1
- Support iOS BGHealthResearchTaskRequest (Feature request) HOT 1
- check if periodic task is scheduled
- Error while running app with workmanager package HOT 1
- Issue with WorkManager Periodic Task Scheduling HOT 1
- Periodic Task not working in killed state HOT 7
- How can I invoke work manager from native side? HOT 2
- Documentation - How to communicate between the background task (isolate) and other widgets
- Why need to check type of input data HOT 2
- "Failed to handle method" Exception When Setting "AllowBackup" option in androidManifest.xml HOT 2
- pub.dev 0.5.2 is not the latest version HOT 2
- There is a problem that the calendar schedule that I read with device_calendar is not displayed, so I'm asking for help.
- 🐞Type 'WorkmanagerPlugin' has no member 'registerBGProcessingTask' and Type 'WorkmanagerPlugin' has no member 'registerPeriodicTask' HOT 6
- 🐞[Android production does not work on all phones]
- Methods not working in example app isScheduledByUniqueName
- 🐞 iOS Privacy Manifest is missing HOT 2
- In Android plugin works in killed state when `isInDebugMode: true` but when it's disabled it stops working. How to fix this?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_workmanager.