This class is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services
release, as early as January 2027. There is no direct replacement.
Use this class to create time-based fences.
Constant Summary
| int | DAY_OF_WEEK_FRIDAY | This constant is deprecated. The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement. |
| int | DAY_OF_WEEK_MONDAY | This constant is deprecated. The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement. |
| int | DAY_OF_WEEK_SATURDAY | This constant is deprecated. The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement. |
| int | DAY_OF_WEEK_SUNDAY | This constant is deprecated. The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement. |
| int | DAY_OF_WEEK_THURSDAY | This constant is deprecated. The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement. |
| int | DAY_OF_WEEK_TUESDAY | This constant is deprecated. The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement. |
| int | DAY_OF_WEEK_WEDNESDAY | This constant is deprecated. The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement. |
| int | TIME_INSTANT_SUNRISE | This constant is deprecated. The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement. |
| int | TIME_INSTANT_SUNSET | This constant is deprecated. The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement. |
| int | TIME_INTERVAL_AFTERNOON | This constant is deprecated. The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement. |
| int | TIME_INTERVAL_EVENING | This constant is deprecated. The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement. |
| int | TIME_INTERVAL_HOLIDAY | This constant is deprecated. The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement. |
| int | TIME_INTERVAL_MORNING | This constant is deprecated. The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement. |
| int | TIME_INTERVAL_NIGHT | This constant is deprecated. The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement. |
| int | TIME_INTERVAL_WEEKDAY | This constant is deprecated. The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement. |
| int | TIME_INTERVAL_WEEKEND | This constant is deprecated. The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement. |
Public Method Summary
| static AwarenessFence |
aroundTimeInstant(int timeInstant, long startOffsetMillis, long
stopOffsetMillis)
This method is deprecated. The Awareness API is deprecated and will be
turned down in a future Google Play services release, as early as January 2027.
There is no direct replacement.
|
| static AwarenessFence |
inDailyInterval(TimeZone
timeZone, long startTimeOfDayMillis, long stopTimeOfDayMillis)
This method is deprecated. The Awareness API is deprecated and will be
turned down in a future Google Play services release, as early as January 2027.
There is no direct replacement.
|
| static AwarenessFence |
inInterval(long startTimeMillis, long stopTimeMillis)
This method is deprecated. The Awareness API is deprecated and will be
turned down in a future Google Play services release, as early as January 2027.
There is no direct replacement.
|
| static AwarenessFence |
inIntervalOfDay(int dayOfWeek, TimeZone
timeZone, long startTimeOfDayMillis, long stopTimeOfDayMillis)
This method is deprecated. The Awareness API is deprecated and will be
turned down in a future Google Play services release, as early as January 2027.
There is no direct replacement.
|
| static AwarenessFence |
inTimeInterval(int timeInterval)
This method is deprecated. The Awareness API is deprecated and will be
turned down in a future Google Play services release, as early as January 2027.
There is no direct replacement.
|
Inherited Method Summary
Constants
public static final int DAY_OF_WEEK_FRIDAY
This constant is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services
release, as early as January 2027. There is no direct replacement.
Corresponds to Friday
public static final int DAY_OF_WEEK_MONDAY
This constant is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services
release, as early as January 2027. There is no direct replacement.
Corresponds to Monday
public static final int DAY_OF_WEEK_SATURDAY
This constant is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services
release, as early as January 2027. There is no direct replacement.
Corresponds to Saturday
public static final int DAY_OF_WEEK_SUNDAY
This constant is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services
release, as early as January 2027. There is no direct replacement.
Corresponds to Sunday
public static final int DAY_OF_WEEK_THURSDAY
This constant is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services
release, as early as January 2027. There is no direct replacement.
Corresponds to Thursday
public static final int DAY_OF_WEEK_TUESDAY
This constant is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services
release, as early as January 2027. There is no direct replacement.
Corresponds to Tuesday
public static final int DAY_OF_WEEK_WEDNESDAY
This constant is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services
release, as early as January 2027. There is no direct replacement.
Corresponds to Wednesday
public static final int TIME_INSTANT_SUNRISE
This constant is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services
release, as early as January 2027. There is no direct replacement.
Denotes sunrise at the device location.
public static final int TIME_INSTANT_SUNSET
This constant is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services
release, as early as January 2027. There is no direct replacement.
Denotes sunset at the device location.
public static final int TIME_INTERVAL_AFTERNOON
This constant is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services
release, as early as January 2027. There is no direct replacement.
Denotes the period of a day that is classified as afternoon (for example 12 noon - 4PM)
public static final int TIME_INTERVAL_EVENING
This constant is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services
release, as early as January 2027. There is no direct replacement.
Denotes the period of a day that is classified as evening (for example 4PM - 9PM)
public static final int TIME_INTERVAL_HOLIDAY
This constant is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services
release, as early as January 2027. There is no direct replacement.
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.
public static final int TIME_INTERVAL_MORNING
This constant is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services
release, as early as January 2027. There is no direct replacement.
Denotes the period of a day that is classified as morning (for example 8AM - 12 noon)
public static final int TIME_INTERVAL_NIGHT
This constant is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services
release, as early as January 2027. There is no direct replacement.
Denotes the period of a day that is classified as night (for example 9PM - 8AM)
public static final int TIME_INTERVAL_WEEKDAY
This constant is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services
release, as early as January 2027. There is no direct replacement.
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.
public static final int TIME_INTERVAL_WEEKEND
This constant is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services
release, as early as January 2027. There is no direct replacement.
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.
Public Methods
public static AwarenessFence aroundTimeInstant (int timeInstant, long startOffsetMillis, long stopOffsetMillis)
This method is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services
release, as early as January 2027. There is no direct replacement.
This is a time fence that is in the FenceState.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 FenceState.TRUE
state during the period [T + startOffsetMillis, T + stopOffsetMillis].
Parameters
| timeInstant | 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 | 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 | 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
AwarenessFencethat is TRUE when 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 |
public static AwarenessFence inDailyInterval (TimeZone timeZone, long startTimeOfDayMillis, long stopTimeOfDayMillis)
This method is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services
release, as early as January 2027. There is no direct replacement.
This fence is in the FenceState.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).
Note: prior to Play services 11.0.1 a null value for the
timeZone parameter throws a NullPointerException.
Parameters
| 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 | 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 | milliseconds since the start of the day. Same range as
startTimeOfDayMillis. This time must be greater than or equal to
startTimeOfDayMillis. |
Returns
public static AwarenessFence inInterval (long startTimeMillis, long stopTimeMillis)
This method is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services
release, as early as January 2027. There is no direct replacement.
This fence is in the FenceState.TRUE
state when the current time is within the absolute times indicated by
startTimeMillis and stopTimeMillis.
Parameters
| startTimeMillis | Milliseconds since epoch for the start of the interval. Must be greater than or equal to 0L. |
|---|---|
| stopTimeMillis | Milliseconds since epoch for the end of the interval. Must be greater than or
equal to startTimeMillis. |
Returns
public static AwarenessFence inIntervalOfDay (int dayOfWeek, TimeZone timeZone, long startTimeOfDayMillis, long stopTimeOfDayMillis)
This method is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services
release, as early as January 2027. There is no direct replacement.
This fence is in the FenceState.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).
Note: prior to Play services 11.0.1 a null value for the
timeZone parameter throws a NullPointerException.
Parameters
| dayOfWeek | 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 | 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 | 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 | Milliseconds since the start of the day, This time must be greater than or
equal to startTimeOfDayMillis. |
Returns
public static AwarenessFence inTimeInterval (int timeInterval)
This method is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services
release, as early as January 2027. There is no direct replacement.
This fence is in the FenceState.TRUE
state if the day attributes for the present day/time is one of the attributes specified
in the given dayAttributes.
Parameters
| timeInterval | 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
AwarenessFencethat triggers when the day attributes of the present moment is the specified attribute .