public class Schedule extends Object implements Parcelable, Cloneable
SavedTrip or SavedLocation. The schedule defines essential
aspects of scheduling the SavedTrip or SavedLocation including what the arrival/departure
time should be, whether (and when) to notify the user and any recurrence details.
A Schedule can be created with one of two options:
Schedule.OneTimeScheduleOptions: For a one time scheduling which does not repeat.Schedule.RecurringScheduleOptions: For a recurring schedules which repeats based on a user defined cadence. // Notify the user about this trip 10 minutes before departure time
NotificationOptions notificationOptions = new NotificationOptions(true, 10);
// Timezone is set to UTC regardless of what timezone the user is currently in or the origin is in
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
format.setTimeZone(TimeZone.getTimeZone("UTC"));
// Set the departure time to February 15, 2015 at 17:33:23 (at the origin)
Date dateTime = format.parse("2015-02-15T17:33:23");
OneTimeScheduleOptions scheduleOptions = new OneTimeScheduleOptions(ScheduleType.DEPARTURE, dateTime);
Schedule schedule = new Schedule(scheduleOptions, notificationOptions);
Example: Recurring schedule every Saturday and Sunday
// Do not notify the user
NotificationOptions notificationOptions = null;
// Timezone is set to UTC regardless of what timezone the user is currently in or the origin is in
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
format.setTimeZone(TimeZone.getTimeZone("UTC"));
// Set the departure time of the first occurrence to February 15, 2015 at 17:33:23 (at the origin)
Date dateTime = format.parse("2015-02-15T17:33:23");
RecurringScheduleOptions scheduleOptions = new RecurringScheduleOptions(ScheduleType.DEPARTURE, dateTime, Arrays.asList(Calendar.SATURDAY, Calendar.SUNDAY));
Schedule schedule = new Schedule(scheduleOptions, notificationOptions);| Modifier and Type | Class and Description |
|---|---|
static class |
Schedule.NotificationOptions
Represents the options for notifications for a schedule.
|
static class |
Schedule.OneTimeScheduleOptions
Represents the options for a one time schedule.
|
static class |
Schedule.RecurringScheduleOptions
Represents the options for a recurring schedule.
|
static class |
Schedule.ScheduleOptions
Represents the options for a
Schedule. |
static class |
Schedule.ScheduleType
ScheduleType determines whether it should be scheduled with a specified
arrival time (taking into consideration traffic and stops) or a specified departure time. |
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>| Modifier and Type | Field and Description |
|---|---|
static Parcelable.Creator<Schedule> |
CREATOR
Parcelable creator for this type.
|
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE| Constructor and Description |
|---|
Schedule(Schedule.ScheduleOptions scheduleOptions,
Schedule.NotificationOptions notificationOptions)
|
| Modifier and Type | Method and Description |
|---|---|
int |
describeContents() |
boolean |
equals(Object o) |
Schedule.NotificationOptions |
getNotificationOptions()
Get the notification options associated with this
Schedule. |
Schedule.ScheduleOptions |
getScheduleOptions()
Get the schedule options associated with this
Schedule. |
int |
hashCode() |
void |
setNotificationOptions(Schedule.NotificationOptions notificationOptions)
Set the notification options associated with this
Schedule. |
void |
setScheduleOptions(Schedule.ScheduleOptions scheduleOptions)
Set the schedule options associated with this
Schedule. |
String |
toString() |
void |
writeToParcel(Parcel dest,
int flags) |
public static final Parcelable.Creator<Schedule> CREATOR
public Schedule(@NonNull Schedule.ScheduleOptions scheduleOptions, @Nullable Schedule.NotificationOptions notificationOptions)
scheduleOptions - Schedule options such as date, time and recurrence.notificationOptions - Notification options such as notification time.Schedule.OneTimeScheduleOptions,
Schedule.RecurringScheduleOptions,
Schedule.NotificationOptionspublic final int describeContents()
describeContents in interface Parcelablepublic final void writeToParcel(Parcel dest, int flags)
writeToParcel in interface Parcelablepublic Schedule.NotificationOptions getNotificationOptions()
Schedule.Schedule.NotificationOptionspublic void setNotificationOptions(@Nullable Schedule.NotificationOptions notificationOptions)
Schedule.notificationOptions - Notification options, may be null.Schedule.NotificationOptionspublic Schedule.ScheduleOptions getScheduleOptions()
Schedule. Caller should check the
value of Schedule.ScheduleOptions.isRecurring() to determine whether the returned object is an
instance of Schedule.OneTimeScheduleOptions or Schedule.RecurringScheduleOptions.Schedule.OneTimeScheduleOptions,
Schedule.RecurringScheduleOptionspublic void setScheduleOptions(@NonNull Schedule.ScheduleOptions scheduleOptions)
Schedule.scheduleOptions - Schedule options.Schedule.OneTimeScheduleOptions,
Schedule.RecurringScheduleOptionsCopyright © 2013-2016 INRIX, Inc. All Rights Reserved.