JulianAssmann / flutter_background

A flutter plugin to keep apps running in the background via foreground services. Android only.
https://pub.dev/packages/flutter_background
MIT License
85 stars 45 forks source link

App Still active After Swipe up from Memory #49

Open rohitsangwan01 opened 2 years ago

rohitsangwan01 commented 2 years ago

Describe the bug Great package Man , but am facing an issue , my app is keeping a connection with bluetooth device in background , and that connection depends on a Stream , so as soon as i close that stream , connection will be lost from Bluetooth device , so it was working fine without this package , when i swipe up app from Memory , App disconneted from Bluetooth Device , which was fine , but now after using this package , even if i swipe up app , that bluetooth Device remains still connected with my phone , means it still keeping that stream active somehow , even if app is not live in memory , also noticed one thing , when i use app in debug mode with VSCODE , there when we close app and clear from App , Vscode should show "Lost Connection From Device " , but after using this package , even Vscode remains connected , and Hot Reload/Refresh commands Work

Smartphone:

JulianAssmann commented 2 years ago

Mmh interesting, I will investigate the issue when I have the time.

rohitsangwan01 commented 2 years ago

@JulianAssmann , i think Foreground services keeping the app active even if we swipe up the app from taskbar of mobile , but it calls that Terminate service method in native android, maybe we can have a callback there , so that flutter user can perform some task in that callback , when user swipe up app

JulianAssmann commented 2 years ago

It's a bit weird, because as you said we already terminate the foreground service when the user swipes up, so I thought the app would be completely closed and terminated after that with nothing keeping the Dart/Flutter isolate from being destroyed. The callback is a good idea anyway. I was working on callbacks for action buttons anyway, so that is a logical next step. Thanks for the suggestion.