开发者

Display Android Bluetooth Device Name

How t开发者_Go百科o display a bluetooth device name in android which uses Java? Any codes for me to refer to?


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;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜