Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display Android Bluetooth Device Name

How to display a bluetooth device name in android which uses Java? Any codes for me to refer to?

like image 554
TunA Avatar asked Jul 12 '11 09:07

TunA


1 Answers

The below code will get u the bluetooth name, here mBluetoothAdapter is of type BluetoothAdapter.

  public String getLocalBluetoothName(){
    if(mBluetoothAdapter == null){
        mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
    }
    String name = mBluetoothAdapter.getName();
    if(name == null){
        System.out.println("Name is null!");
        name = mBluetoothAdapter.getAddress();
    }
    return name;
}
like image 54
Hussain Avatar answered Oct 21 '22 17:10

Hussain