How to make an Android device vibrate?

后端 未结 13 2013
长发绾君心
长发绾君心 2020-11-22 15:47

I wrote an Android application. Now, I want to make the device vibrate when a certain action occurs. How can I do this?

13条回答
  •  星月不相逢
    2020-11-22 16:35

    You can Vibrate the Device and its work

       Vibrator v = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
               v.vibrate(100);
    

    Permission is necessary but not on runtime permission required

    
    

提交回复
热议问题