get Default Alarm Uri - Android Android OS

Android examples for Android OS:Alarm Information

Description

get Default Alarm Uri

Demo Code

//package com.java2s;
import java.lang.reflect.Field;
import android.net.Uri;
import android.provider.Settings;

public class Main {
    public static Uri getDefaultAlarmUri() {
        // DEFAULT_ALARM_ALERT_URI is only available after SDK version 5.
        // Fall back to the default notification if the default alarm is
        // unavailable.
        try {//from   w  ww .  j  a  va 2s  .co m
            Field f = Settings.System.class
                    .getField("DEFAULT_ALARM_ALERT_URI");
            return (Uri) f.get(null);
        } catch (Exception e) {
            return Settings.System.DEFAULT_NOTIFICATION_URI;
        }
    }
}

Related Tutorials