Android怎么实现蓝牙自动配对

Android如何实现蓝牙自动配对
Android开发如何实现蓝牙的自动配对,能够写代码实现设置pin码和配对的功能,不要弹出系统自带的对话框。

急求答案!!

------解决方案--------------------
eoe 看到过:

<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://www.eoeandroid.com/thread-80036-1-1.html