TimeIntervals
Stay organized with collections
Save and categorize content based on your preferences.
Public Method Summary
abstract int[] |
getTimeIntervals()
Get the semantic time intervals for the to the current time and location.
|
abstract boolean |
hasTimeInterval(int desiredTimeInterval)
Returns true if the given semantic time interval is applicable to the current
time and locale
|
Public Methods
public abstract int[] getTimeIntervals ()
Get the semantic time intervals for the to the current time and location.
public abstract boolean
hasTimeInterval (int
desiredTimeInterval)
Returns true if the given semantic time interval is applicable to the current time
and locale
Parameters
desiredTimeInterval |
is the desired time interval label. |
Returns
- true if the label is applicable to the current time and locale.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[null,null,["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eTimeIntervals\u003c/code\u003e provides semantic time intervals relative to the current time and location, such as morning, afternoon, weekend, or holiday.\u003c/p\u003e\n"],["\u003cp\u003eYou can retrieve applicable time intervals using \u003ccode\u003egetTimeIntervals()\u003c/code\u003e, which returns an array of constants.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003ehasTimeInterval()\u003c/code\u003e allows you to check if a specific time interval (e.g., TIME_INTERVAL_MORNING) is currently applicable.\u003c/p\u003e\n"]]],["The `TimeIntervals` interface provides methods to determine semantic time intervals relevant to the current time and location. `getTimeIntervals()` returns an array of integer constants, representing applicable time intervals like morning, afternoon, evening, night, weekday, weekend, and holiday. `hasTimeInterval(int desiredTimeInterval)` checks if a specific time interval, identified by an integer label, applies to the present time and locale, returning true if it does.\n"],null,["# TimeIntervals\n\npublic interface **TimeIntervals** \nThe semantic time intervals for the to the current time and location. Some examples of\ntime intervals are: [TIME_INTERVAL_MORNING](/android/reference/com/google/android/gms/awareness/fence/TimeFence#TIME_INTERVAL_MORNING), [TIME_INTERVAL_AFTERNOON](/android/reference/com/google/android/gms/awareness/fence/TimeFence#TIME_INTERVAL_AFTERNOON), [TIME_INTERVAL_EVENING](/android/reference/com/google/android/gms/awareness/fence/TimeFence#TIME_INTERVAL_EVENING), [TIME_INTERVAL_NIGHT](/android/reference/com/google/android/gms/awareness/fence/TimeFence#TIME_INTERVAL_NIGHT), [TIME_INTERVAL_WEEKDAY](/android/reference/com/google/android/gms/awareness/fence/TimeFence#TIME_INTERVAL_WEEKDAY), [TIME_INTERVAL_WEEKEND](/android/reference/com/google/android/gms/awareness/fence/TimeFence#TIME_INTERVAL_WEEKEND), [TIME_INTERVAL_HOLIDAY](/android/reference/com/google/android/gms/awareness/fence/TimeFence#TIME_INTERVAL_HOLIDAY). \n\n### Public Method Summary\n\n|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract int\\[\\] | [getTimeIntervals](/android/reference/com/google/android/gms/awareness/state/TimeIntervals#getTimeIntervals())() Get the semantic time intervals for the to the current time and location. |\n| abstract boolean | [hasTimeInterval](/android/reference/com/google/android/gms/awareness/state/TimeIntervals#hasTimeInterval(int))(int desiredTimeInterval) Returns true if the given semantic time interval is applicable to the current time and locale |\n\nPublic Methods\n--------------\n\n#### public abstract int\\[\\] **getTimeIntervals** ()\n\nGet the semantic time intervals for the to the current time and location. \n\n##### Returns\n\n- the int constants corresponding to all the semantic time interval labels that are applicable for the current time and device locale. Valid time interval labels are: [TIME_INTERVAL_MORNING](/android/reference/com/google/android/gms/awareness/fence/TimeFence#TIME_INTERVAL_MORNING), [TIME_INTERVAL_AFTERNOON](/android/reference/com/google/android/gms/awareness/fence/TimeFence#TIME_INTERVAL_AFTERNOON), [TIME_INTERVAL_EVENING](/android/reference/com/google/android/gms/awareness/fence/TimeFence#TIME_INTERVAL_EVENING), [TIME_INTERVAL_NIGHT](/android/reference/com/google/android/gms/awareness/fence/TimeFence#TIME_INTERVAL_NIGHT), [TIME_INTERVAL_WEEKDAY](/android/reference/com/google/android/gms/awareness/fence/TimeFence#TIME_INTERVAL_WEEKDAY), [TIME_INTERVAL_WEEKEND](/android/reference/com/google/android/gms/awareness/fence/TimeFence#TIME_INTERVAL_WEEKEND), [TIME_INTERVAL_HOLIDAY](/android/reference/com/google/android/gms/awareness/fence/TimeFence#TIME_INTERVAL_HOLIDAY). \n\n#### public abstract boolean\n**hasTimeInterval** (int desiredTimeInterval)\n\nReturns true if the given semantic time interval is applicable to the current time\nand locale \n\n##### Parameters\n\n| desiredTimeInterval | is the desired time interval label. |\n|---------------------|-------------------------------------|\n\n##### Returns\n\n- true if the label is applicable to the current time and locale."]]