##What is Awarness API? A unified sensing platform enabling applications to be aware of multiple aspects of a users context, while managing battery and memory health.
####There are two types of awarness APIs.
- Snapshot APIs.
- Fence APIs.
##Snapshot APIs:
- This app demo icludes usage of 7 diffrent types of apis.
- User Activity - Returns user's current activity. (e.g. Walking, still, in vehicle etc.)
- Time - Returns user's current local time
- Headphones - Status of headphones.
- Location - Current location
- Places - Near by places
- Beacons - Nearby beacons
- Weather - Weather condition at current location.
- The
SnapshotApiActivity.java
contains all these APIs and their demos. - For more details visit this link.
##Fence Apis:
- Available fences:
- DetectedActivityFence - Detect condition based on user's activity
- HeadphoneFence - Detect condition based on headphones plugging in state.
- TimeFence - Detect condition based on local time at user's location.
- LocationFence - Detect condition based on user's location.
- BeaconFence - Detect condition based on nearby Beacons' state.
HeadphoneFenceApiActivity.java
andActivityFenceApiActivity.java
will demostarate how to use this fences without combining them with other fences.- For more details visit this link.
####Combining diffrent feces:
- There are 3 operators to combine diffrent fences and generate desire conditons:
- OR condition- Performs or conditons between two fences unsing
AwarenessFence.or()
. - AND condition- Performs and conditons between two fences unsing
AwarenessFence.and()
. - NOT condition- Performs not conditons between two fences unsing
AwarenessFence.not()
.
- OR condition- Performs or conditons between two fences unsing
CombineFenceApiActivity.java
demostarates how you can combine diffrent fences and generate desire conditions.