我想通过蓝牙将一个Android设备与另一个配对。但它没有配对,甚至没有出现任何错误。有人能告诉我我在这里做错了什么吗?蓝牙没有配对
我有searched for the bluetooth
设备和显示列表。现在我是试图将选定的设备名称与我的设备配对。
但它没有变成paierd,它打开一个对话框取得密码,然后关闭。任何帮助,将不胜感激。 这里是我的代码:
@Override
public void onItemClick(AdapterView<?> parent, View view,int position, long id)
{
Log.i("Log", "ListItem is clicked at :"+position);
posn = position;
String str = (String) listViewDetected.getItemAtPosition(position);
Log.i("Log", "ListItem is :"+str);
bluetoothDevice=arrayListBluetoothDevices.get(position);
Intent intent = new Intent("android.bluetooth.device.action.PAIRING_REQUEST"); intent.putExtra("android.bluetooth.device.extra.DEVICE",bluetoothDevice); intent.putExtra("android.bluetooth.device.extra.PAIRING_VARIANT",0);
startActivityForResult(intent, 1);
}
我已经宣布在manifest文件的权限。
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH" />
帮我解决这个问题。 –
请参考http://stackoverflow.com/questions/4989902/how-to-programmatically-pair-a-bluetooth-device-on-android&http://stackoverflow.com/questions/5885438/bluetooth-pairing-without用户确认这似乎总是发生 –
我已经看到,但没有得到任何关于这个。你能告诉我如何实现配对 –