Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.media.Ringtone; import android.media.RingtoneManager; import android.net.Uri; public class Main { public static long beepTime = 0; public static void ring(Context context) { if ((System.currentTimeMillis() - beepTime) > 6 * 1000) { Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); Ringtone r = RingtoneManager.getRingtone(context.getApplicationContext(), notification); r.play(); beepTime = System.currentTimeMillis(); } else { beepTime = 0; } } }