-
-
Notifications
You must be signed in to change notification settings - Fork 481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Help] BackgroundTask is never executed #85
Comments
If I understand correctly, the supplied example project already exhibits the problem, so I will treat that as your minimal reproduction project. I tried switching to the dev channel to match your flutter doctor output and ran the example project. I noticed that the notification appears without any controls, but I also noticed this in the console which helps diagnose the problem:
Did you not also get the same error, or are you having a different issue? In the mean time, I'll see if I can fix the above error. |
I already resolved that error by initializing WidgetsFlutterBinding.ensureInitialized(), resulted from WidgetBinding. |
I don't see the call to 'ensureInitialized' in your minimal reproduction project. audio_service does call this, but since the latest commit on dev, we can see that audio_service does not call this soon enough. You can work around it by calling ensureInitialized yourself as the first line in your background task entrypoint function, but I am working on a proper fix in #86. But looking at your example code, you need to call the https://pub.dev/documentation/audio_service/latest/audio_service/AudioService/start.html
|
@ronaldG19 I've just published 0.4.0 which addresses the ensureInitialized correctly (See #86 and note the changed API). Also let me know after trying it and also making your background task entrypoint into a top level function whether you still get any errors. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs, or use StackOverflow if you need help with audio_service. |
Describe the bug
Cloned the example project, it only showed the notification without any controls and the music was not played. Integrated into my own project after 3 days of peeking there is no nay notification bar shown or music played.
Minimal reproduction project
To Reproduce
Steps to reproduce the behavior:
then
after running flutter run -v
Runtime Environment (please complete the following information):
Dependencies used
Flutter SDK version
The text was updated successfully, but these errors were encountered: