flutter_reactive_ble
flutter_reactive_ble copied to clipboard
Implement new background Isolate Channels API
Is your feature request related to a problem? (please describe) In order to keep the ble connection alive on Android even if the app was terminated by the user, I tried to use flutter_reactive_ble along with flutter_foreground_task (a plugin that creates persistent background service on Android that runs on another isolate) and when connecting a ble device using flutter_reactive_ble and quitting the app...the flutter_reactive_ble tries to send messages to a destroyed engine (because the app was terminated)
Describe the solution you'd like I think that the new API background Isolate Channels can be used to solve the problem mentioned above.
Describe alternatives you've considered For now and to keep the ble connection alive even if the app is terminated, I'm detecting when the app is terminated and re-connect the device on the other isolate (used by flutter_foreground_task plugin) using a new instance of the flutter_reactive_ble.
Additional context Here is a link to a medium article that describes the usage and benefits of using the new background isolate channels API: https://medium.com/@gaaclarke/introducing-background-isolate-channels-7a299609cad8
Could you please guide me how you do it: "...I'm detecting when the app is terminated and re-connect the device on the other isolate (used by flutter_foreground_task plugin) using a new instance of the flutter_reactive_ble"?