Code example for Vibrator

Methods: hasVibrator

0
        vibrator.vibrate(pattern, -1);
    } 
 
    public boolean hasVibrator() { 
        if (Build.VERSION.SDK_INT > 10) {
            return vibrator.hasVibrator();
        } else { 
            return true; 
        } 
    } 
 
    /** 
     * Plays the 'fail' pattern.  Notifies the registered VibrationCompletedInterface when the duration 
     * of the pattern has passed. 
     */ 
    public void playSadNotified() { 
        long[] sadPattern = {0, 500, 200, 500, 200, 450};
        long duration = 0;
        for (long l : sadPattern) {
            duration = duration + l;
        }