android how to get the name of connected bluetooth device -
this question has answer here:
i want know how name of connected bluetooth device in android here code
networkinfo bluetooth = connectivitymanager .getnetworkinfo(connectivitymanager.type_bluetooth); if(bluetooth.isconnected()) { toast.maketext(myprofile3context,"bluetooth connected", toast.length_short).show(); }
here check if bluetooth device connected or not. if bluetooth connected want know how name of connected device.
try
public string getlocalbluetoothname(){ if(mbluetoothadapter == null){ mbluetoothadapter = bluetoothadapter.getdefaultadapter(); } string name = mbluetoothadapter.getname(); if(name == null){ system.out.println("name null!"); name = mbluetoothadapter.getaddress(); } return name; }
Comments
Post a Comment