我正在开发一个Android应用程序,这个应用程序的一个功能是搜索蓝牙 我周围的设备。
我使用startDiscovery()
和getBondedDevices()
。
getBondedDevices()
几乎正常运作!唯一的缺点是我无法使用myBluetoothDevice.getName().toString()
和myBluetoothDevice.getAddress().toString().
至于startDiscovery()
,似乎这个功能永远不会起作用。
当然我已经定义了BroadcastReceiver并注册了,以下是我的注册码:
IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
registerReceiver(mReceiver, filter);
我使用循环停留在此活动中12秒以接收广播,但它仍然无效!
提前全部谢谢!
答案 0 :(得分:0)