Android Alarm Get getDefaultAlarmUri()

Here you can find the source of getDefaultAlarmUri()

Description

get Default Alarm Uri

License

Apache License

Declaration

public static Uri getDefaultAlarmUri() 

Method Source Code

//package com.java2s;
/****************************************************************************
 * Copyright 2010 kraigs.android@gmail.com
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License. //from  w  ww.  j  a  v a2 s.c o  m
 ****************************************************************************/

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 {
            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

  1. getNextAlarmTimeSpan(String time)
  2. getAlarmManager(Context ctx)
  3. getAlarmManager(Context context)
  4. getDefaultAlarmUri()
  5. getNextAlarmTimeAbsolute(int hourOfDay, int minute)
  6. getAlertDialog(Context context, String title, String message, String okText, DialogInterface.OnClickListener onClickOK)