get bluetooth local device name - Android Bluetooth

Android examples for Bluetooth:Bluetooth Device

Description

get bluetooth local device name

Demo Code


import android.bluetooth.BluetoothAdapter;

public class Main {
  /**/* w  w  w  .  j av a 2 s . c o  m*/
   * get bluetooth local device name
   *
   * @return device name String
   */
  public static String getLocalBluetoothName() {
    BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

    // if device does not support Bluetooth
    if (mBluetoothAdapter == null) {
      return null;
    }

    return mBluetoothAdapter.getName();
  }
}

Related Tutorials