friendly Bluetooth name

SoyEli

Active Member
Licensed User
Longtime User
Hello:

Can anybody tell me how to get "friendly Bluetooth name" from
the headset when the phone connects to it ?

Thank you :)
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

SoyEli

Active Member
Licensed User
Longtime User
Hello Erel:

I'm getting a error:
Can you help ?

service name = "btconnected"

Sub Service_Start (StartingIntent As Intent)
'Bundle[{android.bluetooth.device.extra.DEVICE=00:1C:D8:62:3C:E2}]
'ACL_DISCONNECTED
Dim r As Reflector
r.Target = StartingIntent.GetExtra(StartingIntent)
Dim Name As String
Name = r.RunMethod("getName")
Log("BlueToothName is = " & Name)
End sub





ERROR................................................................


** Activity (main) Resume **
** Service (btconnected) Create **
** Service (btconnected) Start **
btconnected_service_start (java line: 152)

java.lang.NullPointerException
at anywheresoftware.b4a.agraham.reflection.Reflection.runmethod(Reflection.java:186)
at anywheresoftware.b4a.agraham.reflection.Reflection.RunMethod(Reflection.java:780)
at CallManager.com.btconnected._service_start(btconnected.java:152)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:145)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:129)
at CallManager.com.btconnected.handleStart(btconnected.java:61)
at CallManager.com.btconnected.onStartCommand(btconnected.java:46)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3053)
at android.app.ActivityThread.access$3600(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2096)
at android.os.Handler.dispatchMessage(Handler.java:99)


at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
 
Upvote 0
Top