蓝牙自动配对,该如何处理

蓝牙自动配对现在在做关于蓝牙自动配对的问题,自己找了一个如下的方法,可是不能用,各位大侠知道该怎么办吗

蓝牙自动配对
现在在做关于蓝牙自动配对的问题,自己找了一个如下的方法,可是不能用,各位大侠知道该怎么办吗?

蓝牙自动配对代码修改

先是写个
<receiver android:name=".broadcast.PairingRequest">
                  <intent-filter>
                    <action android:name="android.bluetooth.device.action.PAIRING_REQUEST" /> 
                    <action android:name="android.bluetooth.device.action.PAIRING_CANCEL" /> 
                  </intent-filter>
                </receiver>

然后是你的
public class PairingRequest extends BroadcastReceiver{
  @Override
  public void onReceive(Context context, Intent intent){
    if (intent.getAction().equals("ACTION_PAIRING_REQUEST")) {
            BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
            byte[] pinBytes = BluetoothDevice.convertPinToBytes("1234");
            device.setPin(pinBytes);
    }
  }
}

其中的蓝牙BluetoothDevice这个类要用源码里的替换下
在这里,这个广播接受者并没有起到作用,各位有什么好办法吗


[解决办法]
http://blog.csdn.net/yuejingjiahong/article/details/6630250
推荐lz看看这篇文章。或许有帮助,呵呵