Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我必须让智能手机振动并同时播放声音。
我试过这样的事情:
soundPool.play(sID, 1.0f, 1.0f, 1, 0,1.0f); vibrator.vibrate(90);
问题是电话会立即振动,但声音池会稍有延迟。
你可以使用vibrator.vibrate(long[] pattern, int repeat)方法。模式数组中的第一个值表示打开振动器之前要等待的毫秒数。
vibrator.vibrate(long[] pattern, int repeat)