Created
July 2, 2013 08:01
-
-
Save px-amaac/5907510 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void startAlarm() { | |
// set vibrate | |
vibrate = (Vibrator) getSystemService(VIBRATOR_SERVICE); | |
long[] vibrate_pattern = { 1000, 200, 200 }; | |
vibrate.vibrate(vibrate_pattern, 0); | |
//check if silent mode is on. | |
if (!pass.getSilent()) { | |
mP = new MediaPlayer(); | |
try { | |
mP.setVolume(1.0f, 1.0f); | |
mP.setDataSource( | |
this, | |
Uri.parse(RingtoneManager.getDefaultUri( | |
RingtoneManager.TYPE_ALARM).toString())); | |
mP.setAudioStreamType(AudioManager.STREAM_ALARM); | |
mP.setLooping(true); | |
mP.prepare(); | |
mP.start(); | |
} catch (Exception e) { | |
mP.release(); | |
alarmActive = false; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment