Vibrate of non-stop

Risky

New Member
B4X:
dim vbr as phone
dim start as button

sub start_click
vbr.vibrate (?)
end sub

What number i should put instead "?" for vibrate of non-stop?

thx
 

Risky

New Member
i enable the phone & refection liberally, but "PhoneVibrate" is deactived yet, please help me
i want vibrate of non-stop when i press a button, i want just code.
B4X:
Sub Process_Globals
    Dim pv As PhoneVibrate 'Required to add the Vibrate permission
End Sub

Sub Globals

End Sub
Sub Activity_Create(FirstTime As Boolean)
    Vibrate(500, 300)
    ToastMessageShow("Click anywhere to stop vibrate.", True)
End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
Sub Activity_Resume

End Sub

Sub Activity_Click
    CancelVibrate
End Sub

Sub Vibrate(On As Long, Off As Long)
    Dim r As Reflector
    r.Target = r.GetContext
    r.Target = r.RunMethod2("getSystemService", "vibrator", "java.lang.String")
    Dim pattern(2) As Long
    pattern(0) = On
    pattern(1) = Off
    r.RunMethod4("vibrate", Array As Object(pattern, 0), Array As String("[J", "java.lang.int"))
End Sub

Sub CancelVibrate
    Dim r As Reflector
    r.Target = r.GetContext
    r.Target = r.RunMethod2("getSystemService", "vibrator", "java.lang.String")
    r.RunMethod("cancel")
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…