2016-11-08 88 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