# Handle to an Android vibrator
extern class Vibrator in "Java" `{ android.os.Vibrator `}
super JavaObject
- redef type SELF: Vibrator
# Vibrate for `n` miliseconds
fun vibrate(n: Int) in "Java" `{ recv.vibrate(n); `}
# Turn off the vibration
fun cancel in "Java" `{ recv.cancel(); `}
+
+ # HACK for bug #845
+ redef fun new_global_ref import sys, Sys.jni_env `{
+ Sys sys = Vibrator_sys(recv);
+ JNIEnv *env = Sys_jni_env(sys);
+ return (*env)->NewGlobalRef(env, recv);
+ `}
end
redef class App
# Get the handle to this device vibrator as a global ref
- fun vibrator: Vibrator is cached do
+ var vibrator: Vibrator is lazy do
var v = vibrator_native(native_activity)
return v.new_global_ref
end