/* * Copyright (C) 2010 The Android Open Source Project * * 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. */ package android.provider; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; /** * The AlarmClock provider contains an Intent action and extras that can be used * to start an Activity to set a new alarm or timer in an alarm clock application. * * Applications that wish to receive the ACTION_SET_ALARM and ACTION_SET_TIMER Intents * should create an activity to handle the Intent that requires the permission * com.android.alarm.permission.SET_ALARM. Applications that wish to create a * new alarm or timer should use * {@link android.content.Context#startActivity Context.startActivity()} so that * the user has the option of choosing which alarm clock application to use. */ public final class AlarmClock { /** * Activity Action: Set an alarm. *
* Activates an existing alarm or creates a new one. *
* This action requests an alarm to be set for a given time of day. If no time of day is * specified, an implementation should start an activity that is capable of setting an alarm * ({@link #EXTRA_SKIP_UI} is ignored in this case). If a time of day is specified, and * {@link #EXTRA_SKIP_UI} is {@code true}, and the alarm is not repeating, the implementation * should remove this alarm after it has been dismissed. If an identical alarm exists matching * all parameters, the implementation may re-use it instead of creating a new one (in this case, * the alarm should not be removed after dismissal). *
* This action always enables the alarm. *
* This activity could also be started in Voice Interaction mode. The activity should check * {@link android.app.Activity#isVoiceInteraction}, and if true, the implementation should * report a deeplink of the created/enabled alarm using * {@link android.app.VoiceInteractor.CompleteVoiceRequest}. This allows follow-on voice actions * such as {@link #ACTION_VOICE_CANCEL_ALARM} to cancel the alarm that was just enabled. *
** Cancels the specified alarm by voice. To cancel means to disable, but not delete, the alarm. * See {@link #ACTION_VOICE_DELETE_ALARM} to delete an alarm by voice. *
* The alarm to cancel can be specified or searched for in one of the following ways: *
* Deletes the specified alarm by voice. * See {@link #ACTION_VOICE_CANCEL_ALARM} to cancel (disable) an alarm by voice. *
* The alarm to delete can be specified or searched for in one of the following ways: *
* Activates an existing timer or creates a new one. *
* This action requests a timer to be started for a specific {@link #EXTRA_LENGTH length} of * time. If no {@link #EXTRA_LENGTH length} is specified, the implementation should start an * activity that is capable of setting a timer ({@link #EXTRA_SKIP_UI} is ignored in this case). * If a {@link #EXTRA_LENGTH length} is specified, and {@link #EXTRA_SKIP_UI} is {@code true}, * the implementation should remove this timer after it has been dismissed. If an identical, * unused timer exists matching both parameters, an implementation may re-use it instead of * creating a new one (in this case, the timer should not be removed after dismissal). * * This action always starts the timer. *
* ** This action opens the alarms page. *
*/ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_SHOW_ALARMS = "android.intent.action.SHOW_ALARMS"; /** * Bundle extra: Specify the type of search mode to look up an alarm. ** Used by {@link #ACTION_VOICE_CANCEL_ALARM} and {@link #ACTION_VOICE_DELETE_ALARM} to identify * the alarm(s) to cancel or delete, respectively. *
* This extra is only required when the alarm is not already identified by a deeplink as * specified in the Intent's data URI. *
* The value of this extra is a {@link String}, restricted to the following set of supported * search modes: *
* Used by {@link #ACTION_VOICE_CANCEL_ALARM} and {@link #ACTION_VOICE_DELETE_ALARM}. *
* This extra is optional and only used when {@link #EXTRA_ALARM_SEARCH_MODE} is set to * {@link #ALARM_SEARCH_MODE_TIME}. In this search mode, the {@link #EXTRA_IS_PM} is * used together with {@link #EXTRA_HOUR} and {@link #EXTRA_MINUTES}. The implementation should * look up the alarm that is most closely matched by these search parameters. * If {@link #EXTRA_IS_PM} is missing, then the AM/PM of the specified {@link #EXTRA_HOUR} is * ambiguous and the implementation should ask for clarification from the user. *
* The value is a {@link Boolean}, where false=AM and true=PM. *
* * @see #ACTION_VOICE_CANCEL_ALARM * @see #ACTION_VOICE_DELETE_ALARM * @see #EXTRA_HOUR * @see #EXTRA_MINUTES */ public static final String EXTRA_IS_PM = "android.intent.extra.alarm.IS_PM"; /** * Bundle extra: Weekdays for repeating alarm. ** Used by {@link #ACTION_SET_ALARM}. *
* The value is an {@code ArrayList
* Used by {@link #ACTION_SET_ALARM}. *
* This extra is optional. If not provided, an implementation should open an activity * that allows a user to set an alarm with user provided time. *
* The value is an {@link Integer} and ranges from 0 to 23. *
* * @see #ACTION_SET_ALARM * @see #EXTRA_MINUTES * @see #EXTRA_DAYS */ public static final String EXTRA_HOUR = "android.intent.extra.alarm.HOUR"; /** * Bundle extra: The length of the timer in seconds. ** Used by {@link #ACTION_SET_TIMER}. *
* This extra is optional. If not provided, an implementation should open an activity * that allows a user to set a timer with user provided length. *
* The value is an {@link Integer} and ranges from 1 to 86400 (24 hours). *
* * @see #ACTION_SET_TIMER */ public static final String EXTRA_LENGTH = "android.intent.extra.alarm.LENGTH"; /** * Bundle extra: A custom message for the alarm or timer. ** Used by {@link #ACTION_SET_ALARM} and {@link #ACTION_SET_TIMER}. *
* The value is a {@link String}. *
* * @see #ACTION_SET_ALARM * @see #ACTION_SET_TIMER */ public static final String EXTRA_MESSAGE = "android.intent.extra.alarm.MESSAGE"; /** * Bundle extra: The minutes of the alarm. ** Used by {@link #ACTION_SET_ALARM}. *
* The value is an {@link Integer} and ranges from 0 to 59. If not provided, it defaults to 0. *
* * @see #ACTION_SET_ALARM * @see #EXTRA_HOUR * @see #EXTRA_DAYS */ public static final String EXTRA_MINUTES = "android.intent.extra.alarm.MINUTES"; /** * Bundle extra: A ringtone to be played with this alarm. ** Used by {@link #ACTION_SET_ALARM}. *
* This value is a {@link String} and can either be set to {@link #VALUE_RINGTONE_SILENT} or * to a content URI of the media to be played. If not specified or the URI doesn't exist, * {@code "content://settings/system/alarm_alert} will be used. *
* * @see #ACTION_SET_ALARM * @see #VALUE_RINGTONE_SILENT * @see #EXTRA_VIBRATE */ public static final String EXTRA_RINGTONE = "android.intent.extra.alarm.RINGTONE"; /** * Bundle extra: Whether or not to display an activity after performing the action. ** Used by {@link #ACTION_SET_ALARM} and {@link #ACTION_SET_TIMER}. *
* If true, the application is asked to bypass any intermediate UI. If false, the application * may display intermediate UI like a confirmation dialog or settings. *
* The value is a {@link Boolean}. The default is {@code false}. *
* * @see #ACTION_SET_ALARM * @see #ACTION_SET_TIMER */ public static final String EXTRA_SKIP_UI = "android.intent.extra.alarm.SKIP_UI"; /** * Bundle extra: Whether or not to activate the device vibrator. ** Used by {@link #ACTION_SET_ALARM}. *
* The value is a {@link Boolean}. The default is {@code true}. *
* * @see #ACTION_SET_ALARM * @see #EXTRA_RINGTONE * @see #VALUE_RINGTONE_SILENT */ public static final String EXTRA_VIBRATE = "android.intent.extra.alarm.VIBRATE"; /** * Bundle extra value: Indicates no ringtone should be played. ** Used by {@link #ACTION_SET_ALARM}, passed in through {@link #EXTRA_RINGTONE}. *
* * @see #ACTION_SET_ALARM * @see #EXTRA_RINGTONE * @see #EXTRA_VIBRATE */ public static final String VALUE_RINGTONE_SILENT = "silent"; }