Closed leeflix closed 2 months ago
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'm googling for MissingPluginException all over the internet, hoping to gain some insight. No workarounds yet.
@kumbulali , @irjayjay
I have a working proof of concept flutter_beacon and flutter_foregound_task. I've refactored flutter_beacon though. https://github.com/futureware-tech/flutter_foreground_service
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: https://github.com/Dev-hwang/flutter_foreground_task/issues/77#issuecomment-1203775491
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
@typexy
Sure, I've done changes in the android folder of flutter_beacon.
Please have a look at changes here: https://github.com/alann-maulana/flutter_beacon/compare/master...futureware-tech:flutter_beacon:background
As of flutter 3.7 you can use plugins in any isolate :eyes: 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. In my case, it works fine on Android, but when I run it on iOS, the following issues occur.
*** Terminating app due to uncaught exception of class 'FlutterError' libc++abi: terminating with uncaught exception of type FlutterError
__pthread_kill + 8 libsystem_kernel.dylib
:
-> 0x1ff0d7160 <+8>: b.lo 0x1ff0d7180 ; <+40>
0x1ff0d7164 <+12>: pacibsp
0x1ff0d7168 <+16>: stp x29, x30, [sp, #-0x10]!
0x1ff0d716c <+20>: mov x29, sp
Target 0: (Runner) stopped.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.
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?
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: