AndroidのBluetoothChatのサンプルプロジェクトから
自動でのペアリングをsetPinとcreateBondを使って行いたいと考えています。

 以下の様に記述してみましたがうまくいきません。
どうすればいいでしょうか。
エラーは
 The Method createBond() in the type BluetoothDevice is not applicable for the arguments()
 The method convertPinToBytes(String) is undefined for the type BluetoothDevice
とでています。以下、ソースです。

private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();

Log.d(TAG, "Action:" + action);

if (BluetoothDevice.ACTION_BOND_STATE_CHANGED.equals(action)) {
Log.d(TAG, "ACTION_BOND_STATE_CHANGED");
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
Method createBond = device.getClass().getMethod("createBond", new Class[] {});
boolean a = device.createBond(wifiInfo.getMacAddress());
boolean b = device.setPin(device.getAddress(), BluetoothDevice.convertPinToBytes("0000"));
Log.d(TAG, "createBond:" + a + ", setPin:" + b);
if (a && b) {
Log.d(TAG, "AutoPairing Success !");
}
}