run Alarm via MediaPlayer - Android Android OS

Android examples for Android OS:Alarm Information

Description

run Alarm via MediaPlayer

Demo Code


//package com.java2s;
import android.content.Context;
import android.media.MediaPlayer;

public class Main {

    public static void runAlarm(Context context, int alarm) {
        MediaPlayer mediaPlayer = MediaPlayer.create(context, alarm);
        mediaPlayer.setVolume(1, 1);/*from  w w  w. ja v a 2s  .  c om*/
        mediaPlayer.setLooping(true);
        mediaPlayer.start();
    }
}

Related Tutorials