-
Notifications
You must be signed in to change notification settings - Fork 125
Using flutter_foreground_task together with flutter_blue #84
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
Comments
Same problem TT |
I have the similar problem with the different plugin that is flutter_beacon. I can not initiate the plugin inside of task handlers onStart function. |
Having similar issues here. Different plugins that have this issue with the isolate at different times. |
I have a working proof of concept flutter_beacon and flutter_foregound_task. I've refactored flutter_beacon though. Please add your beacons in the lib/fs/beacon_example.dart file. I hope it will be helpful. |
I found the issue with running plugins in isolates such as this library. Please see my reply on a similar issue in this repo: Hope this helps. Check the plugin's repo issues to find how they solve MissingPluginException when using pre-Flutter 3.0.0, otherwise simply upgrade to Flutter 3.0.0 (I wouldn't recommend it, there are various bugs). |
@ksheremet many thanks for the poc. I compared your refactored flutter_beacon project and the original one and unfortunately didn't really spot a difference. Would it be possible for you to give me a hint what exactly you refactored so that I can be able to do it, too? Any help is highly appreciated @ksheremet Many thanks in advance |
Sure, I've done changes in the android folder of flutter_beacon. Please have a look at changes here: alann-maulana/flutter_beacon@master...futureware-tech:flutter_beacon:background |
As of flutter 3.7 you can use plugins in any isolate 👀 maybe that will help you guys https://medium.com/flutter/whats-new-in-flutter-3-7-38cbea71133c |
Just before starting the foreground service make sure all permissions are enabled for bluetooth |
I am also using flutter_foreground_task and flutter_blue_plus. *** Terminating app due to uncaught exception of class 'FlutterError'
Advice please. |
My use of flutter_foreground_task and flutter_blue_plus (version 1.29.11) is functioning as intended. Note: Ensure that all necessary permissions are requested within the app itself. Please be aware that foreground service does not support permissions. |
how are you doing this? I need to listen to a a Characteristic Stream and reform calculation with the value? |
Any example usages to get into? |
I am trying to make an app that uses flutter_foreground_task to scan for bluetooth devices while it is in the background with the help of flutter_blue. Is this possible? When I am taking the example of flutter_foreground_task and insert the example of flutter_blue into it I get the following error:
When I insert the code in the
initState
method for example it works. It seems that we cannot use plugins that use platform channels in the background or is there a workaround or am I overseeing something?Code:
The text was updated successfully, but these errors were encountered: