Android Question Turn Bluetooth On SDK 33+ error

Scantech

Well-Known Member
Licensed User
Longtime User
Why is this error occuring. Works good with Erels Bluetooth Chat Example but not my project? How I get it going for Activity?

B4X:
Private Sub StartActivityForResult(i As Intent)

    Dim jo As JavaObject = GetBA

    ion = jo.CreateEvent("anywheresoftware.b4a.IOnActivityResult", "ion", Null)

    jo.RunMethod("startActivityForResult", Array As Object(ion, i))

End Sub



Sub GetBA As Object

    Dim jo As JavaObject = Me

    Return jo.RunMethod("getBA", Null)

End Sub
 
Last edited:

Scantech

Well-Known Member
Licensed User
Longtime User
Found the problem.

Use this for Activity and not B4xPages
B4X:
Sub GetBA As Object
   Dim jo As JavaObject
   Dim cls As String = Me
   cls = cls.SubString("class ".Length)
   jo.InitializeStatic(cls)
   Return jo.GetField("processBA")
End Sub
 
Upvote 0

Cristian Achim

Member
Licensed User
Longtime User
It worked for me too. Thank you for sharing.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…