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

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

unity3d - Fatal error- Monodevelop-Unity failed to start -