Skip to content

Commit b31a623

Browse files
123lxw123pauldemarco
authored andcommitted
modify Android connect device method (pauldemarco#229)
1 parent fe64c5c commit b31a623

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

android/src/main/java/com/pauldemarco/flutterblue/FlutterBluePlugin.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,12 @@ public void onMethodCall(MethodCall call, Result result) {
214214
}
215215

216216
// New request, connect and add gattServer to Map
217-
BluetoothGatt gattServer = device.connectGatt(activity, options.getAndroidAutoConnect(), mGattCallback);
217+
BluetoothGatt gattServer;
218+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
219+
gattServer = device.connectGatt(activity, options.getAndroidAutoConnect(), mGattCallback, BluetoothDevice.TRANSPORT_LE);
220+
} else {
221+
gattServer = device.connectGatt(activity, options.getAndroidAutoConnect(), mGattCallback);
222+
}
218223
mGattServers.put(deviceId, gattServer);
219224
result.success(null);
220225
break;

0 commit comments

Comments
 (0)