Roughly a year after launching its Awareness API, Google is improving the API's time fencing functionality in response to developer feedback. Previously, time fencing was limited to absolute/canonical time (e.g. 10:30 a.m., 11:00 p.m., etc.). However, it became apparent that people refer to time in more abstract terms in the ordinary course of life (e.g. before lunch, in the evening, during the week, etc.). Accordingly, Google has added semantic time support to the Awareness API.
With semantic time support, developers can set up fences with more generic terms. For instance, say you wanted an alarm clock to ring every weekday, except for public holidays. The various contextual aspects of the Awareness API would allow a developer to 1: identify the holidays for a specific country or region, 2: exempt weekends and the public holidays from the rule, 3: set the alarm for the appropriate times and days without having to specifically call out every holiday and day of the week. Semantic time support allows for widespread rules without long lines of code as required under absolute/canonical time.
The Awareness API includes two contextual signals that developers can use to build apps: the Snapshot API and the Fence API. The Snapshot API allows apps the request information about a user's specific context (e.g. is the headset plugged in). The Fence API, allows an app to react to a change in context (e.g. set an alert for when a user begins walking). Users can now utilize semantic time within the Fence API, paired with Snapshot API feature for a more dynamic use case scenario (e.g. set an alert when a user leaves the house after sunset). For more examples, and links to the applicable docs, check out Google's blog post announcement.