Sub Activity_Create(FirstTime As Boolean)
Dim v As PhoneVibrate
v.Vibrate(10000000)
End Sub
Sub Activity_Click
Dim v As JavaObject = GetContext
v = v.RunMethodJO("getSystemService", Array ("vibrator")).RunMethod("cancel", Null)
End Sub
Sub GetContext As JavaObject
Return GetBA.GetField("context")
End Sub
Sub GetBA As JavaObject
Dim jo As JavaObject
Dim cls As String = Me
cls = cls.SubString("class ".Length)
jo.InitializeStatic(cls)
Return jo.GetFieldJO("processBA")
End Sub
The first part of the code below returns True - as expected. But there seems to be a problem with the syntax of the last line of code. Want vibrator to vibrate for 2000ms. Can someone please point me in the right direction?
B4X:
Dim telMgr1 As JavaObject = GetContext.RunMethod("getSystemService", Array("vibrator"))
Dim vib As Boolean = telMgr1.RunMethod("hasVibrator", Null)
Log(vib)
telMgr1.RunMethod("vibrate", Array As Object(2000))
This is the error:
java.lang.RuntimeException: Method: vibrate not matched.
Hi Erel, I got it working via Java code that I have added to my fiddleAround library (and compiled with SLC) but also want to try and understand how to do it via the RunMethod.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.