Trying to figure out how to get an android device to vibrate.
I do this on iOS with declares.
little help?
Trying to figure out how to get an android device to vibrate.
I do this on iOS with declares.
little help?
i found this about in case xojo not offer vibrate.
Yes I’ve done this in AS.
It’s one of the last things I need to complete my first Xojo Android project.
Does that work for you:
android.permission.VIBRATE
Declare Sub import Lib "android.os.*:Import"
Declare Function vibrator Lib "android.content.Context.Instance:Kotlin" Alias _
"getSystemService(android.content.Context.VIBRATOR_SERVICE)" _
(context As Ptr) As Ptr
Declare Function createOneShot Lib "Kotlin" Alias _
"VibrationEffect.createOneShot(durationmillis.toLong(), VibrationEffect.DEFAULT_AMPLITUDE)" _
(durationMillis As Int64) As Ptr
Declare Sub vibrate Lib "android.os.Vibrator.Instance:Kotlin" Alias _
"vibrate(effect as VibrationEffect)" _
(ref As Ptr, effect As Ptr)
Var oVibrator As Ptr = vibrator(App.AndroidContextHandle)
Var oEffect As Ptr = createOneShot(200)
vibrate(oVibrator, oEffect)
Sure does!
Thank you very much!