【发布时间】:2012-01-25 18:08:58
【问题描述】:
当我发现设备时,我实际上是这样做的:
IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
this.registerReceiver(mDiscovery, filter);
在我的广播接收器中:
String action = intent.getAction();
if (BluetoothDevice.ACTION_FOUND.equals(action)) {
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
if (device.getBondState() != BluetoothDevice.BOND_BONDED) {
然后我可以执行 device.getName() 和 device.getAddress()。
我的问题是,我只知道如何通过intent 进行发现。因此,据我所知,android 设备都有已配对设备的列表,它们的名称作为各自的地址。
给定名称,我如何直接(无需发现,因此无需广播接收器)获取地址?
【问题讨论】: