[X] I've looked at the README 'Common Problems' section
Have you checked this problem on the example app?
No
FlutterBluePlus Version
1.29.6
Flutter Version
2.19.6
What OS?
Android
OS Version
Android 13
Bluetooth Module
/
What is your problem?
We're noticing in our crash and error reporting (Sentry) a lot of FlutterBluePlusExceptions thrown with the error code SCAN_FAILED_APPLICATION_REGISTRATION_FAILED.
From the breadcrumbs it seems to have to do with a bluetooth scan still being initiated after the Android smartphone screen is turned off and our app is put into a dreaming state by the OS.
// listen & push to `scanResults` stream
_scanSubscription = outputStream.listen((BmScanResponse? response) {
if (response == null) {
// if null, this is just a periodic update to remove old results
if (output._removeWhere((elm) => DateTime.now().difference(elm.timeStamp) > removeIfGone!)) {
_scanResults.add(List.from(output)); // push to stream
}
} else {
// failure?
if (response.success == false) {
throw FlutterBluePlusException(_nativeError, "scan", response.errorCode, response.errorString);
}
Because the exception gets thrown inside the listener there is no way for our code to catch it and handle it.
There should be no exception thrown here.
Requirements
Have you checked this problem on the example app?
No
FlutterBluePlus Version
1.29.6
Flutter Version
2.19.6
What OS?
Android
OS Version
Android 13
Bluetooth Module
/
What is your problem?
We're noticing in our crash and error reporting (Sentry) a lot of FlutterBluePlusExceptions thrown with the error code SCAN_FAILED_APPLICATION_REGISTRATION_FAILED. From the breadcrumbs it seems to have to do with a bluetooth scan still being initiated after the Android smartphone screen is turned off and our app is put into a dreaming state by the OS.
The exception seems to be thrown inside the listener on the output stream. In the file https://github.com/boskokg/flutter_blue_plus/blob/master/lib/src/flutter_blue_plus.dart on line 276.
Because the exception gets thrown inside the listener there is no way for our code to catch it and handle it. There should be no exception thrown here.
Logs