This commit is contained in:
2026-09-24 16:25:22 +08:00
commit 7428184f01
1198 changed files with 314515 additions and 0 deletions
@@ -0,0 +1,21 @@
import Vibrator from "android.os.Vibrator"
import Context from 'android.content.Context'
/**
* 震动
* @param {number} duriation 震动时间单位ms
*/
export function vibrator(duriation : number):boolean {
try {
const context = UTSAndroid.getAppContext() as Context
let vb = context.getSystemService(Context.VIBRATOR_SERVICE) as Vibrator;
if (vb!.hasVibrator()) {
vb!.vibrate(duriation.toLong());
} else {
return false
}
} catch (e) {
console.error(e)
}
return false
}