Code example for Vibrator

Methods: hasVibrator, vibrate

0
			twinkle(); 
	} 
	 
	private void vibrate() { 
		vibrator = (Vibrator) getSystemService(Activity.VIBRATOR_SERVICE);
		if(vibrator.hasVibrator())
			vibrator.vibrate(VIBRATE_PATTERN, 0);
	} 
	 
	private void playRingtone() { 
		try { 
			mediaPlayer = new MediaPlayer();
			mediaPlayer.setDataSource(this, Uri.parse(getAlarm().getType().getRingtone()));
			mediaPlayer.setAudioStreamType(AudioManager.STREAM_ALARM);
			mediaPlayer.setLooping(true);
			mediaPlayer.prepare();
			mediaPlayer.start();
		} catch(IOException e) { e.printStackTrace(); }
	} 
	 
	public void stopAlarm() {