2

Due to security reason, bluetoothAdapter.getAddress() is returning 02:00:00:00:00:00 from Android Marshmallow. I try to get from android.provider.Settings.Secure but still fail. So is there a way to get the local bluetooth mac address?

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    bluetooth_address = android.provider.Settings.Secure.getString(getContentResolver(), "bluetooth_address");
    address = findViewById(R.id.address1);
    address.setText(bluetooth_address);
}

“I expect the textView will be set as 6B:3E:CB:2E:C4:C7, but the actual output is null.”

LaoDa581
  • 563
  • 4
  • 18

0 Answers0