chipweinberger / flutter_blue_plus

Flutter plugin for connecting and communicationg with Bluetooth Low Energy devices, on Android, iOS, macOS
Other
791 stars 478 forks source link

[Reature]:Bluetooth search problem[Help]: #883

Closed wkk199 closed 6 months ago

wkk199 commented 6 months ago

Requirements

Have you checked this problem on the example app?

Yes

FlutterBluePlus Version

1.32.7

Flutter Version

3.19.6

What OS?

Android

OS Version

Android 13

Bluetooth Module

esp32

What is your problem?

My mundane calls to startScan and stopScan ended up with an empty onScanResults callback

Logs

_scanResultsSubscription = FlutterBluePlus.onScanResults.listen(
        (results) {
          if (results.isNotEmpty) {
            for (ScanResult result in results) {
              print("result=====>>${result.device.platformName} ");
            }
          } else {
            print("result=====>>----------$results");
          }
        },
1. Trivial toggle results.isNotEmpty will work
wkk199 commented 6 months ago

Second, after about 4 minutes of searching, onScanResults won't return any results

chipweinberger commented 6 months ago

check permissions

handle onError for scanResults

chipweinberger commented 6 months ago

and give your logs

wkk199 commented 6 months ago

1715831418341 That is, when I click stopScan() and startScan() repeatedly, the isScanning state is true, but the searched device is empty @chipweinberger

wkk199 commented 6 months ago

https://github.com/boskokg/flutter_blue_plus/assets/76580696/8bac09c4-1fd0-41e4-8a75-9c0333dc1f0e

1.These are my steps @chipweinberger

chipweinberger commented 6 months ago

handle onError

you can only scan 6 times per minute on android

wkk199 commented 6 months ago

处理错误

在 Android 上每分钟只能扫描 6 次

I tried to make sure that the scan will not continue if it is larger than 6 times, but onError also did not execute, I change if I handle this problem, I can continue scanning. Is it possible to remove the 6 times limit? @chipweinberger

chipweinberger commented 6 months ago

not possible to remove limit

wkk199 commented 6 months ago

@chipweinberger

无法取消限制

ok,thank you