How to make your device vibrate on Android

Asked 2 years ago, Updated 2 years ago, 20 views

How do I make my Android device vibrate?

android java vibrate android-vibration

2022-09-21 21:07

1 Answers

import android.os.Vibrator;
 ...
 Vibrator v = (Vibrator) this.context.getSystemService(Context.VIBRATOR_SERVICE);
 // Vibrating for 500 milliseconds.
 v.vibrate(500);

You can do it like this.

I went to the Android manifest file <uses-permission android:name="android.permission.VIBRATE"/> You need permission.


2022-09-21 21:07

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.