Example usage for android.os Vibrator vibrate

List of usage examples for android.os Vibrator vibrate

Introduction

In this page you can find the example usage for android.os Vibrator vibrate.

Prototype

@RequiresPermission(android.Manifest.permission.VIBRATE)
    public void vibrate(VibrationEffect vibe) 

Source Link

Usage

From source file:Main.java

public static void KeyVibrate(final Context context) {
    Vibrator vib = (Vibrator) context.getSystemService(Service.VIBRATOR_SERVICE);
    vib.vibrate(100);
}

From source file:Main.java

public static void Vibrate(final Context context, long milliseconds) {
    Vibrator vib = (Vibrator) context.getSystemService(Service.VIBRATOR_SERVICE);
    vib.vibrate(milliseconds);
}

From source file:Main.java

public static void vibrate(final Context context, long milliseconds) {
    Vibrator vib = (Vibrator) context.getSystemService(Service.VIBRATOR_SERVICE);
    vib.vibrate(milliseconds);
}

From source file:Main.java

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

From source file:Main.java

public static void vibrateDevice(Context context, long time) {
    if (context == null)
        return;/*from w ww . j a  va2  s . c om*/

    if (time < 100)
        time = 100;
    if (time > 2000)
        time = 200;
    Vibrator v = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
    v.vibrate(time);
}

From source file:Main.java

public static void setVibrator(Context context, long mms) {
    Vibrator vibe = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
    vibe.vibrate(mms);
}

From source file:Main.java

/**
 * Vibrates the phone for the desired number of milliseconds. Ensure that the vibration
 * permission is listed in the app's manifest file.
 *
 * @param context//from w w  w .  j  av  a  2s .c o m
 * @param milliseconds The number of milliseconds to vibrate the phone for
 */
public static void vibratePhone(Context context, long milliseconds) {
    Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
    vibrator.vibrate(milliseconds);
}

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

From source file:Main.java

/**
 * Causes device to vibrate for the given duration (in millis). If duration is set to 0, then it
 * will use the <code>DEFAULT_VIBRATION_DURATION_MS</code>.
 *///from ww w . ja v  a 2 s .c om
public final static void vibrate(Context context, int duration) {
    if (duration == 0) {
        duration = DEFAULT_VIBRATION_DURATION_MS;
    }
    Vibrator v = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
    v.vibrate(duration);
}

From source file:Main.java

/**
 * Produce una vibracion corta/*from   ww w .ja v  a2s .c  om*/
 *
 * @author Toni
 * @
 * @param  el contexto donde se va a utilizar 
 * @return nada
 * @see    utilidades
 */
public static void vibrar(Context c) {

    try {
        Vibrator v = (Vibrator) c.getSystemService(c.VIBRATOR_SERVICE);
        v.vibrate(30);
    } catch (Exception e) {
        escribeLog("VIBRAR", "Error al intentar vibrar " + e.toString());
    }
}