如何搜索我周围的蓝牙设备?

时间:2013-11-14 06:38:52

标签: android search bluetooth

我正在开发一个Android应用程序,这个应用程序的一个功能是搜索蓝牙 我周围的设备。

我使用startDiscovery()getBondedDevices()

getBondedDevices()几乎正常运作!唯一的缺点是我无法使用myBluetoothDevice.getName().toString()myBluetoothDevice.getAddress().toString().

获取蓝牙耳机的任何信息

至于startDiscovery(),似乎这个功能永远不会起作用。 当然我已经定义了BroadcastReceiver并注册了,以下是我的注册码:

IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
registerReceiver(mReceiver, filter);

我使用循环停留在此活动中12秒以接收广播,但它仍然无效!

提前全部谢谢!

1 个答案:

答案 0 :(得分:0)