Patrick Scott | a73c4b0 | 2010-09-22 08:16:53 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.provider; |
| 18 | |
| 19 | import android.annotation.SdkConstant; |
| 20 | import android.annotation.SdkConstant.SdkConstantType; |
| 21 | |
| 22 | /** |
| 23 | * The AlarmClock provider contains an Intent action and extras that can be used |
Sam Blitzstein | 435e7df | 2013-08-16 17:31:20 -0700 | [diff] [blame] | 24 | * to start an Activity to set a new alarm or timer in an alarm clock application. |
Patrick Scott | a73c4b0 | 2010-09-22 08:16:53 -0400 | [diff] [blame] | 25 | * |
Sam Blitzstein | 435e7df | 2013-08-16 17:31:20 -0700 | [diff] [blame] | 26 | * Applications that wish to receive the ACTION_SET_ALARM and ACTION_SET_TIMER Intents |
| 27 | * should create an activity to handle the Intent that requires the permission |
Patrick Scott | a73c4b0 | 2010-09-22 08:16:53 -0400 | [diff] [blame] | 28 | * com.android.alarm.permission.SET_ALARM. Applications that wish to create a |
Sam Blitzstein | 435e7df | 2013-08-16 17:31:20 -0700 | [diff] [blame] | 29 | * new alarm or timer should use |
Patrick Scott | a73c4b0 | 2010-09-22 08:16:53 -0400 | [diff] [blame] | 30 | * {@link android.content.Context#startActivity Context.startActivity()} so that |
| 31 | * the user has the option of choosing which alarm clock application to use. |
Daniel Cardenas | 4ff933a | 2017-03-31 16:29:11 -0700 | [diff] [blame] | 32 | * |
| 33 | * Android TV devices may not support the alarm intents. |
Patrick Scott | a73c4b0 | 2010-09-22 08:16:53 -0400 | [diff] [blame] | 34 | */ |
| 35 | public final class AlarmClock { |
| 36 | /** |
| 37 | * Activity Action: Set an alarm. |
| 38 | * <p> |
Sam Blitzstein | 435e7df | 2013-08-16 17:31:20 -0700 | [diff] [blame] | 39 | * Activates an existing alarm or creates a new one. |
| 40 | * </p><p> |
Sam Blitzstein | 229ba49 | 2013-08-28 11:42:05 -0700 | [diff] [blame] | 41 | * This action requests an alarm to be set for a given time of day. If no time of day is |
| 42 | * specified, an implementation should start an activity that is capable of setting an alarm |
| 43 | * ({@link #EXTRA_SKIP_UI} is ignored in this case). If a time of day is specified, and |
| 44 | * {@link #EXTRA_SKIP_UI} is {@code true}, and the alarm is not repeating, the implementation |
| 45 | * should remove this alarm after it has been dismissed. If an identical alarm exists matching |
| 46 | * all parameters, the implementation may re-use it instead of creating a new one (in this case, |
| 47 | * the alarm should not be removed after dismissal). |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 48 | * </p><p> |
Sam Blitzstein | 229ba49 | 2013-08-28 11:42:05 -0700 | [diff] [blame] | 49 | * This action always enables the alarm. |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 50 | * </p><p> |
| 51 | * This activity could also be started in Voice Interaction mode. The activity should check |
| 52 | * {@link android.app.Activity#isVoiceInteraction}, and if true, the implementation should |
| 53 | * report a deeplink of the created/enabled alarm using |
| 54 | * {@link android.app.VoiceInteractor.CompleteVoiceRequest}. This allows follow-on voice actions |
Johnson Hsieh | 1ef714a | 2015-06-01 17:55:07 -0700 | [diff] [blame] | 55 | * such as {@link #ACTION_DISMISS_ALARM} to dismiss the alarm that was just enabled. |
Sam Blitzstein | 435e7df | 2013-08-16 17:31:20 -0700 | [diff] [blame] | 56 | * </p> |
| 57 | * <h3>Request parameters</h3> |
| 58 | * <ul> |
| 59 | * <li>{@link #EXTRA_HOUR} <em>(optional)</em>: The hour of the alarm being set. |
| 60 | * <li>{@link #EXTRA_MINUTES} <em>(optional)</em>: The minutes of the alarm being set. |
| 61 | * <li>{@link #EXTRA_DAYS} <em>(optional)</em>: Weekdays for repeating alarm. |
| 62 | * <li>{@link #EXTRA_MESSAGE} <em>(optional)</em>: A custom message for the alarm. |
| 63 | * <li>{@link #EXTRA_RINGTONE} <em>(optional)</em>: A ringtone to play with this alarm. |
| 64 | * <li>{@link #EXTRA_VIBRATE} <em>(optional)</em>: Whether or not to activate the device |
| 65 | * vibrator for this alarm. |
| 66 | * <li>{@link #EXTRA_SKIP_UI} <em>(optional)</em>: Whether or not to display an activity for |
| 67 | * setting this alarm. |
Sam Blitzstein | 435e7df | 2013-08-16 17:31:20 -0700 | [diff] [blame] | 68 | * </ul> |
Patrick Scott | a73c4b0 | 2010-09-22 08:16:53 -0400 | [diff] [blame] | 69 | */ |
| 70 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 71 | public static final String ACTION_SET_ALARM = "android.intent.action.SET_ALARM"; |
| 72 | |
| 73 | /** |
Johnson Hsieh | 1ef714a | 2015-06-01 17:55:07 -0700 | [diff] [blame] | 74 | * Activity Action: Dismiss an alarm. |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 75 | * <p> |
Johnson Hsieh | 1ef714a | 2015-06-01 17:55:07 -0700 | [diff] [blame] | 76 | * The alarm to dismiss can be specified or searched for in one of the following ways: |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 77 | * <ol> |
Johnson Hsieh | 1ef714a | 2015-06-01 17:55:07 -0700 | [diff] [blame] | 78 | * <li>The Intent's data URI, which represents a deeplink to the alarm. |
| 79 | * <li>The extra {@link #EXTRA_ALARM_SEARCH_MODE} to determine how to search for the alarm. |
| 80 | * </ol> |
| 81 | * </p><p> |
| 82 | * If neither of the above are given then: |
| 83 | * <ul> |
| 84 | * <li>If exactly one active alarm exists, it is dismissed. |
Christine Franks | c99c0e2 | 2017-06-13 15:26:09 -0700 | [diff] [blame] | 85 | * <li>If more than one active alarm exists, the user is prompted to choose the alarm to |
| 86 | * dismiss. |
Johnson Hsieh | 1ef714a | 2015-06-01 17:55:07 -0700 | [diff] [blame] | 87 | * </ul> |
| 88 | * </p><p> |
| 89 | * If the extra {@link #EXTRA_ALARM_SEARCH_MODE} is used, and the search results contain two or |
| 90 | * more matching alarms, then the implementation should show an UI with the results and allow |
| 91 | * the user to select the alarm to dismiss. If the implementation supports |
Johnson Hsieh | bcc1ff6 | 2015-06-04 19:51:27 -0700 | [diff] [blame] | 92 | * {@link android.content.Intent#CATEGORY_VOICE} and the activity is started in Voice |
Johnson Hsieh | 1ef714a | 2015-06-01 17:55:07 -0700 | [diff] [blame] | 93 | * Interaction mode (i.e. check {@link android.app.Activity#isVoiceInteraction}), then the |
| 94 | * implementation should additionally use {@link android.app.VoiceInteractor.PickOptionRequest} |
| 95 | * to start a voice interaction follow-on flow to help the user disambiguate the alarm by voice. |
| 96 | * </p><p> |
| 97 | * If the specified alarm is a single occurrence alarm, then dismissing it effectively disables |
| 98 | * the alarm; it will never ring again unless explicitly re-enabled. |
| 99 | * </p><p> |
| 100 | * If the specified alarm is a repeating alarm, then dismissing it only prevents the upcoming |
| 101 | * instance from ringing. The alarm remains enabled so that it will still ring on the date and |
| 102 | * time of the next instance (i.e. the instance after the upcoming one). |
| 103 | * </p> |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 104 | * |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 105 | * @see #EXTRA_ALARM_SEARCH_MODE |
| 106 | */ |
| 107 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
Christine Franks | c99c0e2 | 2017-06-13 15:26:09 -0700 | [diff] [blame] | 108 | public static final String ACTION_DISMISS_ALARM = "android.intent.action.DISMISS_ALARM"; |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 109 | |
| 110 | /** |
Johnson Hsieh | 1ef714a | 2015-06-01 17:55:07 -0700 | [diff] [blame] | 111 | * Activity Action: Snooze a currently ringing alarm. |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 112 | * <p> |
Johnson Hsieh | 1ef714a | 2015-06-01 17:55:07 -0700 | [diff] [blame] | 113 | * Snoozes the currently ringing alarm. The extra {@link #EXTRA_ALARM_SNOOZE_DURATION} can be |
| 114 | * optionally set to specify the snooze duration; if unset, the implementation should use a |
| 115 | * reasonable default, for example 10 minutes. The alarm should ring again after the snooze |
| 116 | * duration. |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 117 | * </p><p> |
Johnson Hsieh | 1ef714a | 2015-06-01 17:55:07 -0700 | [diff] [blame] | 118 | * Note: setting the extra {@link #EXTRA_ALARM_SNOOZE_DURATION} does not change the default |
| 119 | * snooze duration; it's only applied to the currently ringing alarm. |
| 120 | * </p><p> |
| 121 | * If there is no currently ringing alarm, then this is a no-op. |
| 122 | * </p> |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 123 | * |
Johnson Hsieh | 1ef714a | 2015-06-01 17:55:07 -0700 | [diff] [blame] | 124 | * @see #EXTRA_ALARM_SNOOZE_DURATION |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 125 | */ |
| 126 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
Christine Franks | c99c0e2 | 2017-06-13 15:26:09 -0700 | [diff] [blame] | 127 | public static final String ACTION_SNOOZE_ALARM = "android.intent.action.SNOOZE_ALARM"; |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 128 | |
| 129 | /** |
Sam Blitzstein | 435e7df | 2013-08-16 17:31:20 -0700 | [diff] [blame] | 130 | * Activity Action: Set a timer. |
Patrick Scott | a73c4b0 | 2010-09-22 08:16:53 -0400 | [diff] [blame] | 131 | * <p> |
Sam Blitzstein | 435e7df | 2013-08-16 17:31:20 -0700 | [diff] [blame] | 132 | * Activates an existing timer or creates a new one. |
| 133 | * </p><p> |
| 134 | * This action requests a timer to be started for a specific {@link #EXTRA_LENGTH length} of |
Sam Blitzstein | 229ba49 | 2013-08-28 11:42:05 -0700 | [diff] [blame] | 135 | * time. If no {@link #EXTRA_LENGTH length} is specified, the implementation should start an |
| 136 | * activity that is capable of setting a timer ({@link #EXTRA_SKIP_UI} is ignored in this case). |
| 137 | * If a {@link #EXTRA_LENGTH length} is specified, and {@link #EXTRA_SKIP_UI} is {@code true}, |
| 138 | * the implementation should remove this timer after it has been dismissed. If an identical, |
| 139 | * unused timer exists matching both parameters, an implementation may re-use it instead of |
| 140 | * creating a new one (in this case, the timer should not be removed after dismissal). |
| 141 | * |
| 142 | * This action always starts the timer. |
Sam Blitzstein | 435e7df | 2013-08-16 17:31:20 -0700 | [diff] [blame] | 143 | * </p> |
| 144 | * |
| 145 | * <h3>Request parameters</h3> |
| 146 | * <ul> |
| 147 | * <li>{@link #EXTRA_LENGTH} <em>(optional)</em>: The length of the timer being set. |
| 148 | * <li>{@link #EXTRA_MESSAGE} <em>(optional)</em>: A custom message for the timer. |
| 149 | * <li>{@link #EXTRA_SKIP_UI} <em>(optional)</em>: Whether or not to display an activity for |
| 150 | * setting this timer. |
Sam Blitzstein | 435e7df | 2013-08-16 17:31:20 -0700 | [diff] [blame] | 151 | * </ul> |
Patrick Scott | a73c4b0 | 2010-09-22 08:16:53 -0400 | [diff] [blame] | 152 | */ |
Sam Blitzstein | 435e7df | 2013-08-16 17:31:20 -0700 | [diff] [blame] | 153 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 154 | public static final String ACTION_SET_TIMER = "android.intent.action.SET_TIMER"; |
Patrick Scott | a73c4b0 | 2010-09-22 08:16:53 -0400 | [diff] [blame] | 155 | |
| 156 | /** |
Christine Franks | fa4939e | 2017-12-07 15:30:37 -0800 | [diff] [blame] | 157 | * Activity Action: Dismiss a timer. |
Christine Franks | c99c0e2 | 2017-06-13 15:26:09 -0700 | [diff] [blame] | 158 | * <p> |
Christine Franks | fa4939e | 2017-12-07 15:30:37 -0800 | [diff] [blame] | 159 | * The timer to dismiss should be specified using the Intent's data URI, which represents a |
| 160 | * deeplink to the timer. |
| 161 | * </p><p> |
| 162 | * If no data URI is provided, dismiss all expired timers. |
Christine Franks | c99c0e2 | 2017-06-13 15:26:09 -0700 | [diff] [blame] | 163 | * </p> |
Christine Franks | c99c0e2 | 2017-06-13 15:26:09 -0700 | [diff] [blame] | 164 | */ |
| 165 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 166 | public static final String ACTION_DISMISS_TIMER = "android.intent.action.DISMISS_TIMER"; |
| 167 | |
| 168 | /** |
Sean Stout | 1ba3ac9 | 2016-12-05 14:05:03 -0800 | [diff] [blame] | 169 | * Activity Action: Show the timers. |
| 170 | * <p> |
| 171 | * This action opens the timers page. |
| 172 | * </p> |
| 173 | */ |
| 174 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 175 | public static final String ACTION_SHOW_TIMERS = "android.intent.action.SHOW_TIMERS"; |
| 176 | |
| 177 | /** |
Sam Blitzstein | 2f7acd1 | 2013-08-28 15:44:03 -0700 | [diff] [blame] | 178 | * Activity Action: Show the alarms. |
| 179 | * <p> |
| 180 | * This action opens the alarms page. |
| 181 | * </p> |
| 182 | */ |
| 183 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 184 | public static final String ACTION_SHOW_ALARMS = "android.intent.action.SHOW_ALARMS"; |
| 185 | |
| 186 | /** |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 187 | * Bundle extra: Specify the type of search mode to look up an alarm. |
| 188 | * <p> |
Johnson Hsieh | 1ef714a | 2015-06-01 17:55:07 -0700 | [diff] [blame] | 189 | * For example, used by {@link #ACTION_DISMISS_ALARM} to identify the alarm to dismiss. |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 190 | * </p><p> |
Johnson Hsieh | 1ef714a | 2015-06-01 17:55:07 -0700 | [diff] [blame] | 191 | * This extra is only used when the alarm is not already identified by a deeplink as |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 192 | * specified in the Intent's data URI. |
| 193 | * </p><p> |
| 194 | * The value of this extra is a {@link String}, restricted to the following set of supported |
| 195 | * search modes: |
| 196 | * <ul> |
| 197 | * <li><i>Time</i> - {@link #ALARM_SEARCH_MODE_TIME}: Selects the alarm that is most |
| 198 | * closely matched by the search parameters {@link #EXTRA_HOUR}, {@link #EXTRA_MINUTES}, |
| 199 | * {@link #EXTRA_IS_PM}. |
| 200 | * <li><i>Next alarm</i> - {@link #ALARM_SEARCH_MODE_NEXT}: Selects the alarm that will |
| 201 | * ring next, or the alarm that is currently ringing, if any. |
| 202 | * <li><i>All alarms</i> - {@link #ALARM_SEARCH_MODE_ALL}: Selects all alarms. |
Johnson Hsieh | 1ef714a | 2015-06-01 17:55:07 -0700 | [diff] [blame] | 203 | * <li><i>Label</i> - {@link #ALARM_SEARCH_MODE_LABEL}: Search by alarm label. Should return |
| 204 | * alarms that contain the word or phrase in given label. |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 205 | * </ul> |
Johnson Hsieh | 1ef714a | 2015-06-01 17:55:07 -0700 | [diff] [blame] | 206 | * </p> |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 207 | * |
| 208 | * @see #ALARM_SEARCH_MODE_TIME |
| 209 | * @see #ALARM_SEARCH_MODE_NEXT |
| 210 | * @see #ALARM_SEARCH_MODE_ALL |
Johnson Hsieh | 1ef714a | 2015-06-01 17:55:07 -0700 | [diff] [blame] | 211 | * @see #ALARM_SEARCH_MODE_LABEL |
| 212 | * @see #ACTION_DISMISS_ALARM |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 213 | */ |
Christine Franks | c99c0e2 | 2017-06-13 15:26:09 -0700 | [diff] [blame] | 214 | public static final String EXTRA_ALARM_SEARCH_MODE = "android.intent.extra.alarm.SEARCH_MODE"; |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 215 | |
| 216 | /** |
| 217 | * Search for the alarm that is most closely matched by the search parameters |
| 218 | * {@link #EXTRA_HOUR}, {@link #EXTRA_MINUTES}, {@link #EXTRA_IS_PM}. |
| 219 | * In this search mode, at least one of these additional extras are required. |
| 220 | * <ul> |
| 221 | * <li>{@link #EXTRA_HOUR} - The hour to search for the alarm. |
| 222 | * <li>{@link #EXTRA_MINUTES} - The minute to search for the alarm. |
| 223 | * <li>{@link #EXTRA_IS_PM} - Whether the hour is AM or PM. |
| 224 | * </ul> |
| 225 | * |
| 226 | * @see #EXTRA_ALARM_SEARCH_MODE |
| 227 | */ |
Johnson Hsieh | 1ef714a | 2015-06-01 17:55:07 -0700 | [diff] [blame] | 228 | public static final String ALARM_SEARCH_MODE_TIME = "android.time"; |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 229 | |
| 230 | /** |
| 231 | * Selects the alarm that will ring next, or the alarm that is currently ringing, if any. |
| 232 | * |
| 233 | * @see #EXTRA_ALARM_SEARCH_MODE |
| 234 | */ |
Johnson Hsieh | 1ef714a | 2015-06-01 17:55:07 -0700 | [diff] [blame] | 235 | public static final String ALARM_SEARCH_MODE_NEXT = "android.next"; |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 236 | |
| 237 | /** |
| 238 | * Selects all alarms. |
| 239 | * |
| 240 | * @see #EXTRA_ALARM_SEARCH_MODE |
| 241 | */ |
Johnson Hsieh | 1ef714a | 2015-06-01 17:55:07 -0700 | [diff] [blame] | 242 | public static final String ALARM_SEARCH_MODE_ALL = "android.all"; |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 243 | |
| 244 | /** |
Johnson Hsieh | 1ef714a | 2015-06-01 17:55:07 -0700 | [diff] [blame] | 245 | * Search by alarm label. Should return alarms that contain the word or phrase in given label. |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 246 | * |
| 247 | * @see #EXTRA_ALARM_SEARCH_MODE |
| 248 | */ |
Johnson Hsieh | 1ef714a | 2015-06-01 17:55:07 -0700 | [diff] [blame] | 249 | public static final String ALARM_SEARCH_MODE_LABEL = "android.label"; |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 250 | |
| 251 | /** |
| 252 | * Bundle extra: The AM/PM of the alarm. |
| 253 | * <p> |
Johnson Hsieh | 1ef714a | 2015-06-01 17:55:07 -0700 | [diff] [blame] | 254 | * Used by {@link #ACTION_DISMISS_ALARM}. |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 255 | * </p><p> |
| 256 | * This extra is optional and only used when {@link #EXTRA_ALARM_SEARCH_MODE} is set to |
| 257 | * {@link #ALARM_SEARCH_MODE_TIME}. In this search mode, the {@link #EXTRA_IS_PM} is |
| 258 | * used together with {@link #EXTRA_HOUR} and {@link #EXTRA_MINUTES}. The implementation should |
| 259 | * look up the alarm that is most closely matched by these search parameters. |
| 260 | * If {@link #EXTRA_IS_PM} is missing, then the AM/PM of the specified {@link #EXTRA_HOUR} is |
| 261 | * ambiguous and the implementation should ask for clarification from the user. |
| 262 | * </p><p> |
| 263 | * The value is a {@link Boolean}, where false=AM and true=PM. |
| 264 | * </p> |
| 265 | * |
Johnson Hsieh | 1ef714a | 2015-06-01 17:55:07 -0700 | [diff] [blame] | 266 | * @see #ACTION_DISMISS_ALARM |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 267 | * @see #EXTRA_HOUR |
| 268 | * @see #EXTRA_MINUTES |
| 269 | */ |
| 270 | public static final String EXTRA_IS_PM = "android.intent.extra.alarm.IS_PM"; |
| 271 | |
Johnson Hsieh | 1ef714a | 2015-06-01 17:55:07 -0700 | [diff] [blame] | 272 | |
| 273 | /** |
| 274 | * Bundle extra: The snooze duration of the alarm in minutes. |
| 275 | * <p> |
| 276 | * Used by {@link #ACTION_SNOOZE_ALARM}. This extra is optional and the value is an |
| 277 | * {@link Integer} that specifies the duration in minutes for which to snooze the alarm. |
| 278 | * </p> |
| 279 | * |
| 280 | * @see #ACTION_SNOOZE_ALARM |
| 281 | */ |
| 282 | public static final String EXTRA_ALARM_SNOOZE_DURATION = |
| 283 | "android.intent.extra.alarm.SNOOZE_DURATION"; |
| 284 | |
Johnson Hsieh | 633bf5c | 2015-04-01 01:33:31 -0700 | [diff] [blame] | 285 | /** |
Sam Blitzstein | 435e7df | 2013-08-16 17:31:20 -0700 | [diff] [blame] | 286 | * Bundle extra: Weekdays for repeating alarm. |
Patrick Scott | a73c4b0 | 2010-09-22 08:16:53 -0400 | [diff] [blame] | 287 | * <p> |
Sam Blitzstein | 435e7df | 2013-08-16 17:31:20 -0700 | [diff] [blame] | 288 | * Used by {@link #ACTION_SET_ALARM}. |
| 289 | * </p><p> |
| 290 | * The value is an {@code ArrayList<Integer>}. Each item can be: |
| 291 | * </p> |
| 292 | * <ul> |
| 293 | * <li> {@link java.util.Calendar#SUNDAY}, |
| 294 | * <li> {@link java.util.Calendar#MONDAY}, |
| 295 | * <li> {@link java.util.Calendar#TUESDAY}, |
| 296 | * <li> {@link java.util.Calendar#WEDNESDAY}, |
| 297 | * <li> {@link java.util.Calendar#THURSDAY}, |
| 298 | * <li> {@link java.util.Calendar#FRIDAY}, |
| 299 | * <li> {@link java.util.Calendar#SATURDAY} |
| 300 | * </ul> |
Sam Blitzstein | 435e7df | 2013-08-16 17:31:20 -0700 | [diff] [blame] | 301 | */ |
| 302 | public static final String EXTRA_DAYS = "android.intent.extra.alarm.DAYS"; |
| 303 | |
| 304 | /** |
Sam Blitzstein | 435e7df | 2013-08-16 17:31:20 -0700 | [diff] [blame] | 305 | * Bundle extra: The hour of the alarm. |
| 306 | * <p> |
| 307 | * Used by {@link #ACTION_SET_ALARM}. |
| 308 | * </p><p> |
| 309 | * This extra is optional. If not provided, an implementation should open an activity |
| 310 | * that allows a user to set an alarm with user provided time. |
| 311 | * </p><p> |
| 312 | * The value is an {@link Integer} and ranges from 0 to 23. |
| 313 | * </p> |
| 314 | * |
| 315 | * @see #ACTION_SET_ALARM |
| 316 | * @see #EXTRA_MINUTES |
| 317 | * @see #EXTRA_DAYS |
Patrick Scott | a73c4b0 | 2010-09-22 08:16:53 -0400 | [diff] [blame] | 318 | */ |
| 319 | public static final String EXTRA_HOUR = "android.intent.extra.alarm.HOUR"; |
| 320 | |
| 321 | /** |
Sam Blitzstein | 435e7df | 2013-08-16 17:31:20 -0700 | [diff] [blame] | 322 | * Bundle extra: The length of the timer in seconds. |
Patrick Scott | a73c4b0 | 2010-09-22 08:16:53 -0400 | [diff] [blame] | 323 | * <p> |
Sam Blitzstein | 435e7df | 2013-08-16 17:31:20 -0700 | [diff] [blame] | 324 | * Used by {@link #ACTION_SET_TIMER}. |
| 325 | * </p><p> |
| 326 | * This extra is optional. If not provided, an implementation should open an activity |
| 327 | * that allows a user to set a timer with user provided length. |
| 328 | * </p><p> |
| 329 | * The value is an {@link Integer} and ranges from 1 to 86400 (24 hours). |
| 330 | * </p> |
| 331 | * |
| 332 | * @see #ACTION_SET_TIMER |
| 333 | */ |
| 334 | public static final String EXTRA_LENGTH = "android.intent.extra.alarm.LENGTH"; |
| 335 | |
| 336 | /** |
| 337 | * Bundle extra: A custom message for the alarm or timer. |
| 338 | * <p> |
| 339 | * Used by {@link #ACTION_SET_ALARM} and {@link #ACTION_SET_TIMER}. |
| 340 | * </p><p> |
| 341 | * The value is a {@link String}. |
| 342 | * </p> |
| 343 | * |
| 344 | * @see #ACTION_SET_ALARM |
| 345 | * @see #ACTION_SET_TIMER |
| 346 | */ |
| 347 | public static final String EXTRA_MESSAGE = "android.intent.extra.alarm.MESSAGE"; |
| 348 | |
| 349 | /** |
| 350 | * Bundle extra: The minutes of the alarm. |
| 351 | * <p> |
| 352 | * Used by {@link #ACTION_SET_ALARM}. |
| 353 | * </p><p> |
| 354 | * The value is an {@link Integer} and ranges from 0 to 59. If not provided, it defaults to 0. |
| 355 | * </p> |
| 356 | * |
| 357 | * @see #ACTION_SET_ALARM |
| 358 | * @see #EXTRA_HOUR |
| 359 | * @see #EXTRA_DAYS |
Patrick Scott | a73c4b0 | 2010-09-22 08:16:53 -0400 | [diff] [blame] | 360 | */ |
| 361 | public static final String EXTRA_MINUTES = "android.intent.extra.alarm.MINUTES"; |
Patrick Scott | 80fdd65 | 2010-12-15 11:15:13 -0500 | [diff] [blame] | 362 | |
| 363 | /** |
Sam Blitzstein | 435e7df | 2013-08-16 17:31:20 -0700 | [diff] [blame] | 364 | * Bundle extra: A ringtone to be played with this alarm. |
Patrick Scott | 80fdd65 | 2010-12-15 11:15:13 -0500 | [diff] [blame] | 365 | * <p> |
Sam Blitzstein | 435e7df | 2013-08-16 17:31:20 -0700 | [diff] [blame] | 366 | * Used by {@link #ACTION_SET_ALARM}. |
| 367 | * </p><p> |
Sam Blitzstein | 21ea2d0 | 2013-08-21 16:02:21 -0700 | [diff] [blame] | 368 | * This value is a {@link String} and can either be set to {@link #VALUE_RINGTONE_SILENT} or |
| 369 | * to a content URI of the media to be played. If not specified or the URI doesn't exist, |
Sam Blitzstein | 435e7df | 2013-08-16 17:31:20 -0700 | [diff] [blame] | 370 | * {@code "content://settings/system/alarm_alert} will be used. |
| 371 | * </p> |
| 372 | * |
| 373 | * @see #ACTION_SET_ALARM |
Sam Blitzstein | 21ea2d0 | 2013-08-21 16:02:21 -0700 | [diff] [blame] | 374 | * @see #VALUE_RINGTONE_SILENT |
Sam Blitzstein | 435e7df | 2013-08-16 17:31:20 -0700 | [diff] [blame] | 375 | * @see #EXTRA_VIBRATE |
| 376 | */ |
| 377 | public static final String EXTRA_RINGTONE = "android.intent.extra.alarm.RINGTONE"; |
| 378 | |
| 379 | /** |
| 380 | * Bundle extra: Whether or not to display an activity after performing the action. |
| 381 | * <p> |
| 382 | * Used by {@link #ACTION_SET_ALARM} and {@link #ACTION_SET_TIMER}. |
| 383 | * </p><p> |
| 384 | * If true, the application is asked to bypass any intermediate UI. If false, the application |
| 385 | * may display intermediate UI like a confirmation dialog or settings. |
| 386 | * </p><p> |
| 387 | * The value is a {@link Boolean}. The default is {@code false}. |
| 388 | * </p> |
| 389 | * |
| 390 | * @see #ACTION_SET_ALARM |
| 391 | * @see #ACTION_SET_TIMER |
Patrick Scott | 80fdd65 | 2010-12-15 11:15:13 -0500 | [diff] [blame] | 392 | */ |
| 393 | public static final String EXTRA_SKIP_UI = "android.intent.extra.alarm.SKIP_UI"; |
Sam Blitzstein | 435e7df | 2013-08-16 17:31:20 -0700 | [diff] [blame] | 394 | |
| 395 | /** |
| 396 | * Bundle extra: Whether or not to activate the device vibrator. |
| 397 | * <p> |
| 398 | * Used by {@link #ACTION_SET_ALARM}. |
| 399 | * </p><p> |
| 400 | * The value is a {@link Boolean}. The default is {@code true}. |
| 401 | * </p> |
| 402 | * |
| 403 | * @see #ACTION_SET_ALARM |
| 404 | * @see #EXTRA_RINGTONE |
Sam Blitzstein | 21ea2d0 | 2013-08-21 16:02:21 -0700 | [diff] [blame] | 405 | * @see #VALUE_RINGTONE_SILENT |
Sam Blitzstein | 435e7df | 2013-08-16 17:31:20 -0700 | [diff] [blame] | 406 | */ |
| 407 | public static final String EXTRA_VIBRATE = "android.intent.extra.alarm.VIBRATE"; |
| 408 | |
| 409 | /** |
| 410 | * Bundle extra value: Indicates no ringtone should be played. |
| 411 | * <p> |
| 412 | * Used by {@link #ACTION_SET_ALARM}, passed in through {@link #EXTRA_RINGTONE}. |
| 413 | * </p> |
| 414 | * |
| 415 | * @see #ACTION_SET_ALARM |
| 416 | * @see #EXTRA_RINGTONE |
| 417 | * @see #EXTRA_VIBRATE |
| 418 | */ |
| 419 | public static final String VALUE_RINGTONE_SILENT = "silent"; |
Patrick Scott | a73c4b0 | 2010-09-22 08:16:53 -0400 | [diff] [blame] | 420 | } |