刷新Android蓝牙名称缓存

时间:2012-08-02 15:24:53

标签: android bluetooth

我正在尝试编写一些可以进行蓝牙设备发现的代码。

Android为蓝牙设备保留友好名称的缓存:调用BluetoothDevice.getName()返回缓存中的值,如果名称尚未缓存,则调用null

我正在尝试测试没有名称的代码路径。不幸的是,这很难,因为缓存是持久的。一旦Android看到设备一次,就会被缓存,我从未看到Android尝试再次查找该名称。

有没有办法刷新名称缓存以强制Android重新获取名称---最重要的是,这样做时会报告该名称不可用?

1 个答案:

答案 0 :(得分:0)

我认为问题How to programmatically clear the Bluetooth name cache in Android?与您的问题非常相似,可能会对您有所帮助。

相关问题