Time awareness is used to obtain holiday information in most regions and sunrise and sunset time of all cities around the world.
This API is used to set a timer or a barrier based on the target time. For example, one hour before and after the sunrise can be set as a sunrise barrier.
We can use the Capture API to obtains the current local time or time of a specified location, such as working day, weekend, holiday, morning, afternoon, evening, or late at night.
For calling Time Awareness capability we have to assign the given permissions in the manifest file.
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"
/>
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION"
/>
To understand more about Barrier API and Capture API here we are discussing the following two classes:
Let’s go to the details.
This class features barriers to be triggered at a time or periodically based on-time status.
The below table gives the details of different constants that are commonly used in the TimeBarrierclass.
#java #mobile #integration #kotlin #opensource #hms