Don't try to get Bluetooth address from settings.

This commit is contained in:
akwizgran
2023-06-30 18:14:12 +01:00
parent 74f8e84a9b
commit 882f536b8d

View File

@@ -63,11 +63,13 @@ public class AndroidUtils {
return new Pair<>(address, "adapter"); return new Pair<>(address, "adapter");
} }
// Return the address from settings if it's valid and not fake // Return the address from settings if it's valid and not fake
if (SDK_INT < 33) {
address = Settings.Secure.getString(ctx.getContentResolver(), address = Settings.Secure.getString(ctx.getContentResolver(),
"bluetooth_address"); "bluetooth_address");
if (isValidBluetoothAddress(address)) { if (isValidBluetoothAddress(address)) {
return new Pair<>(address, "settings"); return new Pair<>(address, "settings");
} }
}
// Try to get the address via reflection // Try to get the address via reflection
address = getBluetoothAddressByReflection(adapter); address = getBluetoothAddressByReflection(adapter);
if (isValidBluetoothAddress(address)) { if (isValidBluetoothAddress(address)) {