How to programmatically pair a bluetooth device on Android

后端 未结 10 1939
轻奢々
轻奢々 2020-11-30 23:27

For my application I\'m trying to programmatically pair a bluetooth device. I\'m able to show the pairing dialog for the device I want to pair and I can enter a pincode. Whe

10条回答
  •  悲&欢浪女
    2020-11-30 23:59

    in addition to my comment, by the way, even if these ACTION types did exist, that's not how you use them. here's an example:

    Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST);
    intent.putExtra(EXTRA_DEVICE, device);
    int PAIRING_VARIANT_PIN = 272;
    intent.putExtra(BluetoothDevice.EXTRA_PAIRING_VARIANT, PAIRING_VARIANT_PIN);
    sendBroadcast(intent);
    

提交回复
热议问题