Example usage for android.content Context VIBRATOR_SERVICE

List of usage examples for android.content Context VIBRATOR_SERVICE

Introduction

In this page you can find the example usage for android.content Context VIBRATOR_SERVICE.

Prototype

String VIBRATOR_SERVICE

To view the source code for android.content Context VIBRATOR_SERVICE.

Click Source Link

Document

Use with #getSystemService(String) to retrieve a android.os.Vibrator for interacting with the vibration hardware.

Usage

From source file:Main.java

public static void cancel(Context context) {
    ((Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE)).cancel();
}

From source file:Main.java

public static void cancel(final Context context) {
    ((Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE)).cancel();
}

From source file:Main.java

public static void vibrate(Context context) {
    Vibrator v = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
    if (v.hasVibrator()) {
        v.cancel();//w w  w  .  j  a va2 s. com
        v.vibrate(150);
    }
}

From source file:Main.java

public static void cancel(Context context) {
    Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
    vibrator.cancel();
}

From source file:Main.java

public static void vibrate(Context context) {
    Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
    vibrator.vibrate(100);
}

From source file:Main.java

public static void vibrate(Context context) {
    Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
    vibrator.vibrate(500);
}

From source file:Main.java

public static void vibrate(Context thisActivity) {
    Vibrator vibe = (Vibrator) thisActivity.getSystemService(Context.VIBRATOR_SERVICE);

    //28 ms is the default short android vibrate time length
    vibe.vibrate(28);// ww  w.j  a  v a  2 s . c  o  m
}

From source file:Main.java

public static void vibrate(Context context, long milliseconds) {
    android.os.Vibrator vibrator = (android.os.Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
    vibrator.vibrate(milliseconds);//  www. java2 s . c o m
}

From source file:Main.java

public static void vibrator(Context context, int msec) {
    Vibrator vib = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
    if (vib != null) {
        vib.vibrate(msec);/*  w w w .j  av  a 2s  .co m*/
    }
}

From source file:Main.java

public static void vibrate(Context context, long vibrationTime) {
    Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
    vibrator.vibrate(vibrationTime);/*from w  w w .  j a  v a2s.co m*/
}