3

I am running flutter_blue example app on an android device, but scans and find the ble devices nearby but unable to connect them. iOS build of example app can successfully connect the ble devices. Is there a missing configuration for android devices.

Note: I checked permissions, they are ok.

1
  • Have you tried enabling the GPS while trying to connect? Some Android devices require that Commented Oct 10, 2018 at 14:29

1 Answer 1

4

Permissions appear not to be the issue. It finds the ble devices.

I experienced similar issues with flutter_blue on android. It even appeared to be BLE device dependent. It connected fine to some devices, and didn't for others.

In my case, it was just stuck at the connection attempt. Waiting several minutes resolved mostly in a connection, but that's not usable.

I was able to resolve my issue, by turning off autoconnect, so

device.connect(autoConnect: false);

Then it worked for me. Maybe this helps you or other users experiencing the same issues.

Sign up to request clarification or add additional context in comments.

3 Comments

Sidenote for anyone else seeing this: Android unfortunately requires location permissions to be able to scan for BLE devices. Reasons for this are mostly location services, that rely on BLE scans, e.g. for indoor navigation.
This suggestion didn't solve my problem. I can find the device but sometimes can't connect or take long time to establish the connection. This is my connection code snippet: await deviceToConnect .connect(autoConnect: false) .timeout( Duration(seconds: kBleTimeoutConn), onTimeout: () => onTimeOut(), ) .then( (value) async { await checkCurrentState(); if (deviceState == BluetoothDeviceState.connected) { connectionSetup(onConnected: onConnected); } }, );
did you guys find any solution?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.