Code example for Vibrator

Methods: vibrate

0
        if (playBeep && mediaPlayer != null) {
            mediaPlayer.start();
        } 
        if (vibrate) {
            Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
            vibrator.vibrate(VIBRATE_DURATION);
        } 
    } 
 
    /** 
     * When the beep has finished playing, rewind to queue up another one. 
     */ 
    private final OnCompletionListener beepListener = new OnCompletionListener() {
        public void onCompletion(MediaPlayer mediaPlayer) { 
            mediaPlayer.seekTo(0); 
        } 
    }; 
 
}