Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/213.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 无停顿的连续振动_Android_Android Vibration - Fatal编程技术网

Android 无停顿的连续振动

Android 无停顿的连续振动,android,android-vibration,Android,Android Vibration,我正在使用可控震源.vibrate(可控震源效果.createOneShot(Integer.MAX_值,可控震源效果.DEFAULT_振幅)); 用于振动。问题是振动只持续1-2秒,而不是很长时间。我也试过了 Vibrator mVibrate = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); long pattern[]={0,800,200,1200,300,2000,400,4000}; // 2nd argument is

我正在使用
可控震源.vibrate(可控震源效果.createOneShot(Integer.MAX_值,可控震源效果.DEFAULT_振幅));
用于振动。问题是振动只持续1-2秒,而不是很长时间。我也试过了

Vibrator mVibrate = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
long pattern[]={0,800,200,1200,300,2000,400,4000};
// 2nd argument is for repetition pass -1 if you do not want to repeat the Vibrate
mVibrate.vibrate(pattern,-1);

但是,即使我将中断设置为0,它也会随着中断而振动。

请查看-->@Wini,但该答案中的任何代码都不会连续振动而不中断。为避免损坏硬件,可能会对持续时间设置OS上限。