TunA
TunA

Reputation: 91

Display Android Bluetooth Device Name

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

Upvotes: 7

Views: 28482

Answers (2)

Hussain
Hussain

Reputation: 5562

The below code will get you 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;
}

Upvotes: 21

Jahid Bhai
Jahid Bhai

Reputation: 1

import android.provider.Settings.Secure; private String android_id = Secure.getString(getContext().getContentResolver(),secure.ANDROID_ID); thi

Upvotes: 0

Related Questions