How to obtain the bluetooth mac addres in android 8.1 and higher programmatically?

Viewed 567

We have an Android application where we need to establish a connection between 2 devices via Bluetooth programmatically.

 String macAddress = android.provider.Settings.Secure.getString(getApplicationContext().getContentResolver(), "bluetooth_address");

However, the above code is not working anymore in Android Oreo and Pie.

Does anybody have a workaround for this issue?

0 Answers
Related