Android 如何在oreo中以编程方式获取移动蓝牙MAC地址

Android 如何在oreo中以编程方式获取移动蓝牙MAC地址,android,bluetooth,bluetooth-lowenergy,core-bluetooth,Android,Bluetooth,Bluetooth Lowenergy,Core Bluetooth,我试图通过编程方式获取移动蓝牙mac id。我看到了一些链接,得到了这个coce String macAddress = android.provider.Settings.Secure.getString(context.getContentResolver(), "bluetooth_address"); 直到牛轧糖,这段代码运行良好。但我在OREO(8.0.0)中得到null,并且我在清单文件中授予了权限 <uses-permission android:name="android

我试图通过编程方式获取移动蓝牙mac id。我看到了一些链接,得到了这个coce

String macAddress = android.provider.Settings.Secure.getString(context.getContentResolver(), "bluetooth_address");
直到牛轧糖,这段代码运行良好。但我在OREO(8.0.0)中得到null,并且我在清单文件中授予了权限

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />


那么,有没有办法在OREO中获取蓝牙mac地址呢?

蓝牙mac地址仅适用于Android OREO中的系统应用程序。请查看答案以了解详细信息。此外,您还可以阅读文章了解更多信息