Getting Started with Vibration

suggest change

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;
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents