【问题标题】:Where should we invoke setPin() for bluetooth pairing in android?我们应该在哪里调用 setPin() 在 android 中进行蓝牙配对?
【发布时间】:2014-08-16 13:24:18
【问题描述】:

我们应该在哪里插入setPin(String pin) 来配对蓝牙设备?函数应该在createBond之前还是之后调用??

在这篇文章中的回答 Howt to connect two devices via bluetooth sending the pairng code by parameter? JAVA-Android 表示应该在调用 createBond() 之前调用它

但是问题How can I avoid or dismiss Android's Bluetooth pairing notification when I am doing programmatic pairing? 告诉了完成蓝牙配对的步骤,其中setPincreateBond() 之后被调用。如果这可行,那么它应该在 BroadcastReceiver 中调用,我们会在其中获取配对请求的回调。

哪种方法是正确的?我真的很困惑!

【问题讨论】:

    标签: java android bluetooth android-bluetooth


    【解决方案1】:

    我发现some test code 似乎建议你在createBond() in response to the BluetoothDevice.ACTION_PAIRING_REQUEST broadcast 之后调用它。

    【讨论】:

      猜你喜欢
      • 2017-01-06
      • 1970-01-01
      • 2017-05-08
      • 2011-05-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-27
      相关资源
      最近更新 更多