如何从装有 OS 11 的 Android 设备获取 mac 地址? [英] How to get mac Address from an Android Device with OS 11?

查看:469
本文介绍了如何从装有 OS 11 的 Android 设备获取 mac 地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用

NetworkInterface.getHardwareAddress() 获取mac地址,

但正如我们从 https://developer.android.com/training/articles/user-data-ids#mac-11-plus

现在它不会用于 Android OS 11

所以有人知道这个问题的解决方案或任何指南都会有很大帮助吗?

so anybody knows solutions to this or any guideline will be a great help ?

推荐答案

Android 指南强制停止使用 mac 地址作为标识符,因为您发布的链接还有其他替代方案,如果您想在 android 11 中使用 mac 几乎是不可能的获得相同的 mac,即使使用 @hafiza 代码(你忘了告诉有一些额外的清单权限)在我的应用程序中,我一直使用 mac 验证,直到 android 9,现在我正在使用这个库 https://github.com/fingerprintjs/fingerprint-android 这是获取某种 id 的非常有用的解决方案.我已经在 Android 9、10 和 11 上进行了测试,没有出现实际问题或随机值.

Android guidelines enforces to stop using mac addressess as identificators, as the link you posted there are other alternatives, if you want to use mac in android 11 is almost impossible to get the same mac, even with @hafiza code (you forgot to tell that there are some aditional manifest permissions) In my app i used mac verification until android 9, now I'm using this library https://github.com/fingerprintjs/fingerprint-android which is a really helpful solution to get some kind of id. I've tested on Android 9, 10 and 11 with no real problems or randomized values.

这篇关于如何从装有 OS 11 的 Android 设备获取 mac 地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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