简体   繁体   中英

Bluetooth connected device

I am wondering if there is any way to check if the device we want to connect to is already connected to the phone. In my case, the device pairs itself to the phone, and connects automatically.

I have not found a way yet to check if the device is already connected before scanning.

I expect something like this:

  1. I turn on Bluetooth on my phone.
  2. I turn on Bluetooth on my device.
  3. The phone automatically connects to device (because they have previously paired and "know" each other).
  4. I don't want to run any scanning to find any possible devices.
  5. I want to show in my app that device is connected.
  6. I want to listen to the status of connection and if the device disco.nets I want to show that as well.

I may be wrong, but every external library like flutter_reactive_ble or flutter_blue_plus has a flow like:

  1. Scan for devices
  2. Connect to the found device
  3. When library know about connected device than it can listen its status.

In my application I just want to know if a device with a certain mac address is connected to the phone the app is running on.

According to this Github issue , you can use FlutterBluePlus.instance.connectedDevices to see a list of all devices connected since FlutterBluePlus was initialized. That would allow you to check the list for a specific device.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM