java.lang.Object | |
↳ | com.google.android.gms.awareness.fence.TimeFence |
Use this class to create time-based fences.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | DAY_OF_WEEK_FRIDAY | Corresponds to Friday | |||||||||
int | DAY_OF_WEEK_MONDAY | Corresponds to Monday | |||||||||
int | DAY_OF_WEEK_SATURDAY | Corresponds to Saturday | |||||||||
int | DAY_OF_WEEK_SUNDAY | Corresponds to Sunday | |||||||||
int | DAY_OF_WEEK_THURSDAY | Corresponds to Thursday | |||||||||
int | DAY_OF_WEEK_TUESDAY | Corresponds to Tuesday | |||||||||
int | DAY_OF_WEEK_WEDNESDAY | Corresponds to Wednesday | |||||||||
int | TIME_INSTANT_SUNRISE | Denotes sunrise at the device location. | |||||||||
int | TIME_INSTANT_SUNSET | Denotes sunset at the device location. | |||||||||
int | TIME_INTERVAL_AFTERNOON | Denotes the period of a day that is classified as afternoon (for example 12 noon - 4PM) | |||||||||
int | TIME_INTERVAL_EVENING | Denotes the period of a day that is classified as evening (for example 4PM - 9PM) | |||||||||
int | TIME_INTERVAL_HOLIDAY | Denotes a government-sanctioned holiday (implying that most schools and offices are closed) for the device locale at the current time (internationalized properly). | |||||||||
int | TIME_INTERVAL_MORNING | Denotes the period of a day that is classified as morning (for example 8AM - 12 noon) | |||||||||
int | TIME_INTERVAL_NIGHT | Denotes the period of a day that is classified as night (for example 9PM - 8AM) | |||||||||
int | TIME_INTERVAL_WEEKDAY | Denotes a weekday for the device locale at the current time (internationalized properly). | |||||||||
int | TIME_INTERVAL_WEEKEND | Denotes a weekend for the device locale at the current time (internationalized properly). |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This is a time fence that is in the
TRUE state during a time interval
defined with respect to TIME_INSTANT_SUNRISE or TIME_INSTANT_SUNSET
instants. | |||||||||||
This fence is in the
TRUE state during the interval specified by
startTimeOfDayMillis and stopTimeOfDayMillis in the given timeZone . | |||||||||||
DEPRECATED.
| |||||||||||
This fence is in the
TRUE state when the current time is within the
absolute times indicated by startTimeMillis and stopTimeMillis . | |||||||||||
This fence is in the
TRUE state on dayOfWeek during the interval
specified by startTimeOfDayMillis to stopTimeOfDayMillis in the given
timeZone . | |||||||||||
DEPRECATED.
| |||||||||||
DEPRECATED.
| |||||||||||
DEPRECATED.
| |||||||||||
DEPRECATED.
| |||||||||||
This fence is in the
TRUE state if the day attributes for the present
day/time is one of the attributes specified in the given dayAttributes . | |||||||||||
DEPRECATED.
| |||||||||||
DEPRECATED.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Corresponds to Friday
Corresponds to Monday
Corresponds to Saturday
Corresponds to Sunday
Corresponds to Thursday
Corresponds to Tuesday
Corresponds to Wednesday
Denotes sunrise at the device location.
Denotes sunset at the device location.
Denotes the period of a day that is classified as afternoon (for example 12 noon - 4PM)
Denotes the period of a day that is classified as evening (for example 4PM - 9PM)
Denotes a government-sanctioned holiday (implying that most schools and offices are closed) for the device locale at the current time (internationalized properly). As an example, in the U.S., some examples of holidays are Thanksgiving day, Christmas day, Independence day.
Denotes the period of a day that is classified as morning (for example 8AM - 12 noon)
Denotes the period of a day that is classified as night (for example 9PM - 8AM)
Denotes a weekday for the device locale at the current time (internationalized properly). As an example, in the U.S., weekdays are understood to be Monday, Tuesday, Wednesday, Thursday, Friday.
Denotes a weekend for the device locale at the current time (internationalized properly). As an example, in the U.S., weekdays are understood to be Saturday and Sunday.
This is a time fence that is in the TRUE
state during a time interval
defined with respect to TIME_INSTANT_SUNRISE
or TIME_INSTANT_SUNSET
instants. For example, if it is relative to TIME_INSTANT_SUNRISE
, and sunrise
time is denoted by variable T, then this fence is in the TRUE
state
during the period [T + startOffsetMillis, T + stopOffsetMillis].
Parameters | |
---|---|
timeInstant |
int :
is the desired semantic time label around which fence triggers
are defined to happen. This value should be one of the following supported labels:
TIME_INSTANT_SUNRISE , TIME_INSTANT_SUNSET . |
startOffsetMillis |
long :
is the offset from the beginning of the semantic time period.
It can be specified as a positive or negative offset value but should be between
-24 to 24 hours inclusive (expressed in millis) |
stopOffsetMillis |
long :
is the offset from the end of the semantic time period.
It can be specified as a positive or negative offset value but should be between
-24 to 24 hours inclusive (expressed in millis)
constraint: startOffsetMillis < stopOffsetMillis |
Returns | |
---|---|
AwarenessFence |
AwarenessFence that is TRUE when the the current time falls within the
interval specified based on the semantic time label and offsets. |
Throws | |
---|---|
IllegalStateException |
if startOffsetMillis >= stopOffsetMillis or if the absolute value of startOffsetMillis or stopOffsetMillis is greater than 24 * 60 * 60 * 1000 which is the millis equivalent of 24 hours. |
IllegalArgumentException |
if an unknown or invalid semantic time label is provided |
This fence is in the TRUE
state during the interval specified by
startTimeOfDayMillis
and stopTimeOfDayMillis
in the given timeZone
.
If the timeZone
is null, the current device time zone is used.
The fence re-adjusts to account for changes to the time zone (e.g. due
to location change, or user-triggered change to Date & time settings).
Parameters | |
---|---|
timeZone |
TimeZone :
The time zone to use. If set to null, current device time zone is used,
and the fence re-adjusts to account for changes to the time zone (e.g. due
to location change, or user-triggered change to Date & time settings). |
startTimeOfDayMillis |
long :
Milliseconds since the start of the day.
12:00 am is 0L. The maximum value is the
number of milliseconds in a day, namely
24L * 60L * 60L * 1000L. |
stopTimeOfDayMillis |
long :
milliseconds since the start of the day. Same
range as startTimeOfDayMillis . This
time must be greater than or
equal to startTimeOfDayMillis . |
Returns | |
---|---|
AwarenessFence |
AwarenessFence
|
DEPRECATED. Use inIntervalOfDay(int, TimeZone, long, long)
instead.
This fence is in the TRUE
state for Friday in the interval specified by
startTimeOfDayMillis
and stopTimeOfDayMillis
in the given
timeZone
. If the timeZone
is null, the current device time zone is used.
The fence re-adjusts to account for changes to the time zone (e.g. due
to location change, or user-triggered change to Date & time settings).
Parameters | |
---|---|
timeZone |
TimeZone :
The time zone to use. If set to null, current device time zone is used,
and the fence re-adjusts to account for changes to the time zone (e.g. due
to location change, or user-triggered change to Date & time settings). |
startTimeOfDayMillis |
long :
Milliseconds since the start of the day.
12:00 am is 0L. The maximum value is the
number of milliseconds in a day, namely
24L * 60L * 60L * 1000L. |
stopTimeOfDayMillis |
long :
Milliseconds since the start of the day,
This time must be greater than or
equal to startTimeOfDayMillis . |
Returns | |
---|---|
AwarenessFence |
AwarenessFence
|
This fence is in the TRUE
state when the current time is within the
absolute times indicated by startTimeMillis
and stopTimeMillis
.
Parameters | |
---|---|
startTimeMillis |
long :
Milliseconds since epoch for the start of the
interval. Must be greater than or equal to 0L. |
stopTimeMillis |
long :
Milliseconds since epoch for the end of the
interval. Must be greater than or equal to startTimeMillis . |
Returns | |
---|---|
AwarenessFence |
AwarenessFence
|
This fence is in the TRUE
state on dayOfWeek
during the interval
specified by startTimeOfDayMillis
to stopTimeOfDayMillis
in the given
timeZone
. If the timeZone
is null, the current device time zone is used.
The fence re-adjusts to account for changes to the time zone (e.g. due
to location change, or user-triggered change to Date & time settings).
Parameters | |
---|---|
dayOfWeek |
int :
is the day of the week. Valid values for this parameter are:
DAY_OF_WEEK_SUNDAY , DAY_OF_WEEK_MONDAY ,
DAY_OF_WEEK_TUESDAY , DAY_OF_WEEK_WEDNESDAY ,
DAY_OF_WEEK_THURSDAY , DAY_OF_WEEK_FRIDAY ,
DAY_OF_WEEK_SATURDAY . |
timeZone |
TimeZone :
The time zone to use. If set to null, current device time zone is used,
and the fence re-adjusts to account for changes to the time zone (e.g. due
to location change, or user-triggered change to Date & time settings). |
startTimeOfDayMillis |
long :
Milliseconds since the start of the day.
12:00 am is 0L. The maximum value is the
number of milliseconds in a day, namely
24L * 60L * 60L * 1000L. |
stopTimeOfDayMillis |
long :
Milliseconds since the start of the day,
This time must be greater than or
equal to startTimeOfDayMillis . |
Returns | |
---|---|
AwarenessFence |
AwarenessFence
|
DEPRECATED. Use inIntervalOfDay(int, TimeZone, long, long)
instead.
This fence is in the TRUE
state for Monday in the interval specified by
startTimeOfDayMillis
and stopTimeOfDayMillis
in the given
timeZone
. If the timeZone
is null, the current device time zone is used.
The fence re-adjusts to account for changes to the time zone (e.g. due
to location change, or user-triggered change to Date & time settings).
Parameters | |
---|---|
timeZone |
TimeZone :
The time zone to use. If set to null, current device time zone is used,
and the fence re-adjusts to account for changes to the time zone (e.g. due
to location change, or user-triggered change to Date & time settings). |
startTimeOfDayMillis |
long :
Milliseconds since the start of the day.
12:00 am is 0L. The maximum value is the
number of milliseconds in a day, namely
24L * 60L * 60L * 1000L. |
stopTimeOfDayMillis |
long :
Milliseconds since the start of the day,
This time must be greater than or
equal to startTimeOfDayMillis . |
Returns | |
---|---|
AwarenessFence |
AwarenessFence
|
DEPRECATED. Use inIntervalOfDay(int, TimeZone, long, long)
instead.
This fence is in the TRUE
state for Saturday in the interval specified
by startTimeOfDayMillis
and stopTimeOfDayMillis
in the given
timeZone
. If the timeZone
is null, the current device time zone is used.
The fence re-adjusts to account for changes to the time zone (e.g. due
to location change, or user-triggered change to Date & time settings).
Parameters | |
---|---|
timeZone |
TimeZone :
The time zone to use. If set to null, current device time zone is used,
and the fence re-adjusts to account for changes to the time zone (e.g. due
to location change, or user-triggered change to Date & time settings). |
startTimeOfDayMillis |
long :
Milliseconds since the start of the day.
12:00 am is 0L. The maximum value is the
number of milliseconds in a day, namely
24L * 60L * 60L * 1000L. |
stopTimeOfDayMillis |
long :
Milliseconds since the start of the day,
This time must be greater than or
equal to startTimeOfDayMillis . |
Returns | |
---|---|
AwarenessFence |
AwarenessFence
|
DEPRECATED. Use inIntervalOfDay(int, TimeZone, long, long)
instead.
This fence is in the TRUE
state for Sunday in the interval specified by
startTimeOfDayMillis
and stopTimeOfDayMillis
in the given
timeZone
. If the timeZone
is null, the current device time zone is used.
The fence re-adjusts to account for changes to the time zone (e.g. due
to location change, or user-triggered change to Date & time settings).
Parameters | |
---|---|
timeZone |
TimeZone :
The time zone to use. If set to null, current device time zone is used,
and the fence re-adjusts to account for changes to the time zone (e.g. due
to location change, or user-triggered change to Date & time settings). |
startTimeOfDayMillis |
long :
Milliseconds since the start of the day.
12:00 am is 0L. The maximum value is the
number of milliseconds in a day, namely
24L * 60L * 60L * 1000L. |
stopTimeOfDayMillis |
long :
Milliseconds since the start of the day,
This time must be greater than or
equal to startTimeOfDayMillis . |
Returns | |
---|---|
AwarenessFence |
AwarenessFence
|
DEPRECATED. Use inIntervalOfDay(int, TimeZone, long, long)
instead.
This fence is in the TRUE
state for Thursday in the interval specified
by startTimeOfDayMillis
and stopTimeOfDayMillis
in the given
timeZone
. If the timeZone
is null, the current device time zone is used.
The fence re-adjusts to account for changes to the time zone (e.g. due
to location change, or user-triggered change to Date & time settings).
Parameters | |
---|---|
timeZone |
TimeZone :
The time zone to use. If set to null, current device time zone is used,
and the fence re-adjusts to account for changes to the time zone (e.g. due
to location change, or user-triggered change to Date & time settings). |
startTimeOfDayMillis |
long :
Milliseconds since the start of the day.
12:00 am is 0L. The maximum value is the
number of milliseconds in a day, namely
24L * 60L * 60L * 1000L. |
stopTimeOfDayMillis |
long :
Milliseconds since the start of the day,
This time must be greater than or
equal to startTimeOfDayMillis . |
Returns | |
---|---|
AwarenessFence |
AwarenessFence
|
This fence is in the TRUE
state if the day attributes for the present
day/time is one of the attributes specified in the given dayAttributes
.
Parameters | |
---|---|
timeInterval |
int :
is the desired attributes of the day for which this fence will trigger.
Some sample attributes are TIME_INTERVAL_MORNING ,
TIME_INTERVAL_AFTERNOON , TIME_INTERVAL_EVENING ,
TIME_INTERVAL_NIGHT , TIME_INTERVAL_WEEKDAY ,
TIME_INTERVAL_WEEKEND , TIME_INTERVAL_HOLIDAY . |
Returns | |
---|---|
AwarenessFence |
AwarenessFence that triggers when the day attributes of the present moment
is the specified attribute .
|
DEPRECATED. Use inIntervalOfDay(int, TimeZone, long, long)
instead.
This fence is in the TRUE
state for Tuesday in the interval specified by
startTimeOfDayMillis
and stopTimeOfDayMillis
in the given
timeZone
. If the timeZone
is null, the current device time zone is used.
The fence re-adjusts to account for changes to the time zone (e.g. due
to location change, or user-triggered change to Date & time settings).
Parameters | |
---|---|
timeZone |
TimeZone :
The time zone to use. If set to null, current device time zone is used,
and the fence re-adjusts to account for changes to the time zone (e.g. due
to location change, or user-triggered change to Date & time settings). |
startTimeOfDayMillis |
long :
Milliseconds since the start of the day.
12:00 am is 0L. The maximum value is the
number of milliseconds in a day, namely
24L * 60L * 60L * 1000L. |
stopTimeOfDayMillis |
long :
Milliseconds since the start of the day,
This time must be greater than or
equal to startTimeOfDayMillis . |
Returns | |
---|---|
AwarenessFence |
AwarenessFence
|
DEPRECATED. Use inIntervalOfDay(int, TimeZone, long, long)
instead.
This fence is in the TRUE
state for Wednesday in the interval specified
by startTimeOfDayMillis
and stopTimeOfDayMillis
in the given
timeZone
. If the timeZone
is null, the current device time zone is used.
The fence re-adjusts to account for changes to the time zone (e.g. due
to location change, or user-triggered change to Date & time settings).
Parameters | |
---|---|
timeZone |
TimeZone :
The time zone to use. If set to null, current device time zone is used,
and the fence re-adjusts to account for changes to the time zone (e.g. due
to location change, or user-triggered change to Date & time settings). |
startTimeOfDayMillis |
long :
Milliseconds since the start of the day.
12:00 am is 0L. The maximum value is the
number of milliseconds in a day, namely
24L * 60L * 60L * 1000L. |
stopTimeOfDayMillis |
long :
Milliseconds since the start of the day,
This time must be greater than or
equal to startTimeOfDayMillis . |
Returns | |
---|---|
AwarenessFence |
AwarenessFence
|