How to Change Device Name / Bluetooth Device for Android devices.


Method : 1


we can change your device name using setName(String name) of BluetoothAdapter type.Following is the sample code:
private BluetoothAdapter bluetoothAdapter = null;
bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

void ChangeDeviceName(){
 Log.i(LOG, "localdevicename : "+bluetoothAdapter.getName()+" localdeviceAddress : "+bluetoothAdapter.getAddress());
 bluetoothAdapter.setName("NewDeviceName");
 Log.i(LOG, "localdevicename : "+bluetoothAdapter.getName()+" localdeviceAddress : "+bluetoothAdapter.getAddress());
}


Method : 2

For some devices Method:1 won't work.  use system settings.
Settings.System.putString(context.getContentResolver(), “device_name”, “user name”);
 

No comments:

Post a Comment