Android Vibration Getting Started with Vibration

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Grant Vibration Permission

before you start implement code, you have to add permission in android manifest :

<uses-permission android:name="android.permission.VIBRATE"/>

Import Vibration Library

import android.os.Vibrator;

Get instance of Vibrator from Context

Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);

Check device has vibrator

void boolean isHaveVibrate(){
    if (vibrator.hasVibrator()) {
        return true;
    }
    return false;
}


Got any Android Question?