BlueTooth AP Name

mitsusdev

Member
Licensed User
Longtime User
Hi,
i want start bluetooth serial listen, changing default B4A access point name.

Is it possible using only Basic4Android or i must change serial/bluetoothAdmin library?
i've tried this solution, initially for show into my code the name and then change it, but i get some errors:


B4X:
devices_view_click (B4A line: 625)
Name = rT.RunMethod("getName")

java.lang.NullPointerException
   at anywheresoftware.b4a.agraham.reflection.Reflection.runmethod(Reflection.java:186)
   at anywheresoftware.b4a.agraham.reflection.Reflection.RunMethod(Reflection.java:780)
   at com.acotelnet.salute.devices._view_click(devices.java:2470)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:507)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:136)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:124)
   at anywheresoftware.b4a.BA.raiseEvent(BA.java:120)
   at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:49)
   at android.view.View.performClick(View.java:2501)
   at android.view.View$PerformClick.run(View.java:9107)
   at android.os.Handler.handleCallback(Handler.java:587)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:130)
   at android.app.ActivityThread.main(ActivityThread.java:3835)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:507)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
   at dalvik.system.NativeStart.main(Native Method)
java.lang.NullPointerException
** Activity (devices) Pause, UserClosed = false **
** Activity (devices) Resume **

This is my code:

B4X:
Dim i As Intent
i.Initialize("android.bluetooth.adapter.action.REQUEST_DISCOVERABLE", "")
                  
i.PutExtra("android.bluetooth.adapter.extra.DISCOVERABLE_DURATION", 300)
StartActivity(i)

Dim rT As Reflector
Dim btIntent As Intent
btIntent.Initialize("","")
rT.Target = btIntent.GetExtra("android.bluetooth.device.extra.DEVICE")
Dim Name As String
Name = rT.RunMethod("getName")
                  
Log("BlueToothName is = " & Name)

Log("Start bluetooth listen...")
serial1.Listen

Regards
 
Last edited:

SoyEli

Active Member
Licensed User
Longtime User
mitsusdev:

Can you show how you was able to get the BLUETOOTH name ?

Using this :
"http://www.b4x.com/forum/basic4android-updates-questions/16555-detect-if-your-connected-bluetooth.html#post94499"

I can get the ID number only, but not the NAME.

Thank you:
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…