为什么每次重新启动应用程序时,BluetoothDevice的地址都会更改? [英] Why the address of my BluetoothDevice changes every time I relaunch the app?

查看:106
本文介绍了为什么每次重新启动应用程序时,BluetoothDevice的地址都会更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用此示例代码

我正在使用Samsung 6和Nexus 9进行测试,由于某种原因,如果我让应用程序在Samsung上运行并在Nexus上重新启动该应用程序,则下一次Samsung设备找到另一台设备时,它将地址不同.

I'm testing it using a Samsung 6 and a Nexus 9, and for some reason if I leave the app running on the Samsung and restart the app on the Nexus, the next time the Samsung devices finds the other device, it has a different address.

在代码中:

在设备上:

有趣的是,它并没有发生. (从Nexus 9中发现时,三星始终具有相同的地址)

The funny thing it doesn't happen the other way around. (Samsung always has the same address when discovered from the Nexus 9)

  • 这是设备之间的常见行为吗?
  • 除了Mac地址之外,还有另一种方法来标识特定设备吗?

推荐答案

正如CommonsWare所述,从Android 6.0开始,Android已以编程方式删除了对硬件地址的访问,并使其变得随机生成以进行扫描.设备.更改日志可以在这里找到:

As CommonsWare mentioned, as of Android 6.0, Android has removed access to the hardware address programmatically, and made it so that the address appears to be randomly generated to scanning devices. The change log can be found here:

http://developer. android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-hardware-id

扫描设备会看到随机的蓝牙地址而不是实际的蓝牙地址这一事实是一项非常有用的隐私保护功能. BTv4.0以来的蓝牙规范已采用了该协议,称为LE隐私:

The fact that scanning devices see a random Bluetooth address rather than the actual one is a highly useful privacy feature. It was adopted by the Bluetooth specification as of BTv4.0 and is known as LE privacy:

"此功能可将广告包中的MAC地址替换为随机值,该随机值会按照制造商确定的时间间隔进行更改.任何恶意设备(沿着您的行驶路线间隔放置)都会无法确定从您的设备接收到的一系列不同的,随机生成的MAC地址实际上与同一物理设备有关,实际上看起来像一系列的不同设备,因此,将无法使用广告中的信息来跟踪您MAC地址" [[1]

您可以在这里找到类似的问题:-

You can find a similar question here:-

自棉花糖使用BluetoothAdapter.getDefaultAdapter().startDiscovery更新蓝牙发现以来. ();坏了

[1] http://blog.bluetooth.com/bluetooth-技术保护您的隐私/

这篇关于为什么每次重新启动应用程序时,BluetoothDevice的地址都会更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆