| class info |
| public final class TimeBarrier extends Object |
| Time barriers, including the barriers to be triggered at a time or periodically based on time status. |
| Type | Name | Desc |
| int | FRIDAY_CODE | Friday. |
| int | MONDAY_CODE | Monday. |
| int | SATURDAY_CODE | Saturday. |
| int | SUNDAY_CODE | Sunday. |
| int | THURSDAY_CODE | Thursday. |
| int | TUESDAY_CODE | Tuesday. |
| int | WEDNESDAY_CODE | Wednesday. |
| int | SUNRISE_CODE | Constant indicating sunrise. |
| int | SUNSET_CODE | Constant indicating sunset. |
| int | TIME_CATEGORY_AFTERNOON | Afternoon time period, that is, 12:00–17:00. |
| int | TIME_CATEGORY_EVENING | Evening time period, that is, 17:00–21:00. |
| int | TIME_CATEGORY_HOLIDAY | Constant indicating holidays. |
| int | TIME_CATEGORY_MORNING | Morning time period, that is, 6:00–12:00. |
| int | TIME_CATEGORY_NIGHT | Night time period, that is, 21:00–06:00 (next day). |
| int | TIME_CATEGORY_WEEKDAY | Constant indicating workdays. |
| int | TIME_CATEGORY_WEEKEND | Constant indicating weekends. |
| int | TIME_CATEGORY_NOT_HOLIDAY | Constant indicating non-holiday dates. |
| Return type | Method name |
| AwarenessBarrier | public static AwarenessBarrier inSunriseOrSunsetPeriod(int timeInstant, long startTimeOffset, long stopTimeOffset) |
| AwarenessBarrier | public static AwarenessBarrier duringPeriodOfDay(TimeZone timeZone, long startTimeOfDay, long stopTimeOfDay) |
| AwarenessBarrier | public static AwarenessBarrier duringTimePeriod(long startTimeStamp, long stopTimeStamp) |
| AwarenessBarrier | public static AwarenessBarrier duringPeriodOfWeek(int dayOfWeek, TimeZone timeZone, long startTimeOfSpecifiedDay, long stopTimeOfSpecifiedDay) |
| AwarenessBarrier | public static AwarenessBarrier inTimeCategory(int timeCategory) |
| Constant |
| public static final int FRIDAY_CODE |
| Friday. Constant Value: 6 |
| Constant |
| public static final int MONDAY_CODE |
| Monday. Constant Value: 2 |
| Constant |
| public static final int SATURDAY_CODE |
| Saturday. Constant Value: 7 |
| Constant |
| public static final int SUNDAY_CODE |
| Sunday. Constant Value: 1 |
| Constant |
| public static final int THURSDAY_CODE |
| Thursday. Constant Value: 5 |
| Constant |
| public static final int TUESDAY_CODE |
| Tuesday. Constant Value: 3 |
| Constant |
| public static final int WEDNESDAY_CODE |
| Wednesday. Constant Value: 4 |
| Constant |
| public static final int SUNRISE_CODE |
| Constant indicating sunrise. Constant Value: 0 |
| Constant |
| public static final int SUNSET_CODE |
| Constant indicating sunset. Constant Value: 1 |
| Constant |
| public static final int TIME_CATEGORY_AFTERNOON |
| Afternoon time period, that is, 12:00–17:00. Constant Value: 2 |
| Constant |
| public static final int TIME_CATEGORY_EVENING |
| Evening time period, that is, 17:00–21:00. Constant Value: 3 |
| Constant |
| public static final int TIME_CATEGORY_HOLIDAY |
| Constant indicating holidays. Constant Value: 5 |
| Constant |
| public static final int TIME_CATEGORY_MORNING |
| Morning time period, that is, 6:00–12:00. Constant Value: 1 |
| Constant |
| public static final int TIME_CATEGORY_NIGHT |
| Night time period, that is, 21:00–06:00 (next day). Constant Value: 4 |
| Constant |
| public static final int TIME_CATEGORY_WEEKDAY |
| Constant indicating workdays. Constant Value: 6 |
| Constant |
| public static final int TIME_CATEGORY_WEEKEND |
| Constant indicating weekends. Constant Value: 7 |
| Constant |
| public static final int TIME_CATEGORY_NOT_HOLIDAY |
| Constant indicating non-holiday dates. Constant Value: 8 |
Parameters
| Parameter name | Parameter desc |
| timeInstant | Constant indicating sunrise or sunset. SUNRISE_CODE SUNSET_CODE |
| startTimeOffset | Start time offset of the time barrier. The unit is millisecond. The value range is milliseconds from –24 hours to +24 hours. The value must be less than the value of stopTimeOffset. |
| stopTimeOffset | Stop time offset of the time barrier. The unit is millisecond. The value range is milliseconds from –24 hours to +24 hours. The value must be greater than the value of startTimeOffset. |
Return
| Type | desc |
| AwarenessBarrier | Awareness barrier. |
Throws
| Parameter name | Parameter desc |
| IllegalArgumentException | An unknown or invalid value of timeInstant is passed, the value of startTimeOffset is greater than or equal to the value of stopTimeOffset, or the absolute value of startTimeOffset or stopTimeOffset is greater than the number of milliseconds in 24 hours. |
Parameters
| Parameter name | Parameter desc |
| timeZone | Time zone specified by you. If the time zone does not exist, the time zone of the area where the user is located is used. |
| startTimeOfDay | Start time of the barrier, in milliseconds. The value 0 indicates 00:00. The maximum value is the number of milliseconds of 24 hours. |
| stopTimeOfDay | Stop time of the barrier, in milliseconds. The value of stopTimeOfDay must be greater than or equal to the value of startTimeOfDay. |
Return
| Type | desc |
| AwarenessBarrier | Awareness barrier. |
Throws
| Parameter name | Parameter desc |
| IllegalArgumentException | The value of startTimeofDay is greater than that of stopTimeofDay, or the value of startTimeofDay or stopTimeofDay is negative, or greater than the number of milliseconds in 24 hours. |
Parameters
| Parameter name | Parameter desc |
| startTimeStamp | Start timestamp. The value must be greater than or equal to 0. |
| stopTimeStamp | Stop timestamp. The value of stopTimeStamp must be greater than or equal to that of startTimeStamp. |
Return
| Type | desc |
| AwarenessBarrier | Awareness barrier. |
Throws
| Parameter name | Parameter desc |
| IllegalArgumentException | The value of startTimeStamp is greater than that of stopTimeStamp, or the value of startTimeStamp or stopTimeStamp is negative. |
Parameters
| Parameter name | Parameter desc |
| dayOfWeek | Day of a week. The options are as follows: SUNDAY_CODE, MONDAY_CODE, TUESDAY_CODE, WEDNESDAY_CODE, THURSDAY_CODE, FRIDAY_CODE, and SATURDAY_CODE. |
| timeZone | Time zone specified by you. If the time zone does not exist, the time zone of the area where the user is located is used. |
| startTimeOfSpecifiedDay | Start time of the barrier, in milliseconds. The value 0 indicates 00:00. The maximum value is the number of milliseconds of 24 hours. |
| stopTimeOfSpecifiedDay | Stop time of the barrier, in milliseconds. The value of stopTimeOfSpecifiedDay must be greater than or equal to the value of startTimeOfSpecifiedDay. |
Return
| Type | desc |
| AwarenessBarrier | Awareness barrier. |
Throws
| Parameter name | Parameter desc |
| IllegalArgumentException | The value of dayOfWeek is incorrect, the value of startTimeOfSpecifiedDay is greater than that of stopTimeOfSpecifiedDay, or the values of startTimeOfSpecifiedDay and stopTimeOfSpecifiedDay are negative or greater than the number of milliseconds in 24 hours. |
Parameters
| Parameter name | Parameter desc |
| timeCategory | Time status constant. The options are as follows: TIME_CATEGORY_MORNING, TIME_CATEGORY_AFTERNOON, TIME_CATEGORY_EVENING, TIME_CATEGORY_NIGHT, TIME_CATEGORY_WEEKDAY, TIME_CATEGORY_WEEKEND, TIME_CATEGORY_HOLIDAY,andTIME_CATEGORY_NOT_HOLIDAY (non-holiday date). |
Return
| Type | desc |
| AwarenessBarrier | Awareness barrier. |
Throws
| Parameter name | Parameter desc |
| IllegalArgumentException | An unknown or invalid value of timeCategory is passed. |