2016-11-08 76 views
1

感谢您检查我的问题。Android蓝牙Ble防止Pair请求

我使用的代码在Android开发者,使BLE连接:

BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(address); 
    if (device == null) { 
     Log.w(TAG, "Device not found. Unable to connect."); 
     return false; 
    } 
    // We want to directly connect to the device, so we are setting the autoConnect 
    // parameter to false. 
    if (mBluetoothGatt != null) { 
     mBluetoothGatt.close(); 
     mBluetoothGatt = null; 
    } 
    mBluetoothGatt = device.connectGatt(this, false, mGattCallback); 

但代码的工作之后,对对话框会显示出来,而我实际上并不需要对工作,我只需要连接客户端,然后发送数据(我需要连接的远程设备已被设置为“不需要配对”),有什么方法可以避免配对呼叫?

谢谢!

回答

0

配对对话框只有在远程设备实际发送“安全请求”数据包时才会出现,表明它想配对。所以你的“不需要配对”设置似乎没有正常工作...

+0

嗯,但我真的取消远程设备的安全要求,导致ios方现在不启动对对话框。 – Sunderr