I'm trying to get the MAC address of Android devices via Settings.Secure, using the following code:
String btMac = android.provider.Settings.Secure.getString(getApplicationContext().getContentResolver(), "bluetooth_address");
It works for several devices that I've tried, including Samsung Galaxy S6/S7/Pixel/Nexus5. However, on some older phones such as a HTC One X (4.2.2), and another generic Android phone (4.1), the string is null.
Is this a Android version issues? Or is it a vendor build issue, i.e. "bluetooth_address" doesn't exist in Settings.Secure for those builds. Is there anyway to see what's available in Settings.Secure for those devices?
Thanks.
Edit: Could it be because BluetoothManager was only introduced in 4.3, and "bluetooth_name" exists in BluetoothManagerService.java, which doesn't exist prior to 4.3?