Example usage for android.bluetooth BluetoothAdapter setName

List of usage examples for android.bluetooth BluetoothAdapter setName

Introduction

In this page you can find the example usage for android.bluetooth BluetoothAdapter setName.

Prototype

@RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
public boolean setName(String name) 

Source Link

Document

Set the friendly Bluetooth name of the local Bluetooth adapter.

Usage

From source file:Main.java

public static void changeBluetoothName(String name) {
    BluetoothAdapter mAdapter = BluetoothAdapter.getDefaultAdapter();
    mAdapter.setName(name);
}

From source file:Main.java

public static boolean setBluetoothDeviceName(String name) {
    if (TextUtils.isEmpty(name)) {
        return false;
    }/*from   w w w  .  ja v a2 s.  c  om*/
    BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
    return adapter.setName(name);
}