Change the Android bluetooth device name

后端 未结 3 2041
忘了有多久
忘了有多久 2020-12-05 11:40

I know it\'s possible to get the local device name as described in the solution to this question Display Android Bluetooth Device Name

What I\'m interested in knowin

3条回答
  •  一整个雨季
    2020-12-05 11:55

    Yes you 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());
                    }
    

提交回复
热议问题