I'm trying to change the bluetooth device name using BluetoothAdapter#setName(String)
method, the method returns true which means the bluetooth adapter name is changed, but after that, the device is no longer discoverable from other devices. Any idea?
BluetoothManager manager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
BluetoothAdapter lAdapter = manager.getAdapter();
if (lAdapter.isEnabled()) {
boolean isChanged = lAdapter.setName("TestName");
if (isChanged) {
Toast.makeText(getBaseContext(), "Bluetooth device name has been changed", Toast.LENGTH_LONG).show();
}
}
EDIT
This code is working fine on Android 8, Xiaomi MI MAX, the problem is on android 10, Xiaomi Redmi 9A