Geofence
A geofence is a virtual perimeter for a real-world geographic area. A geofence is defined by either a geopoint with a radius in case of geopoint geofences, or a MAC address in case of Wi-Fi and Bluetooth geofences. The geofence feature alerts the user when the geofence state changes (the user crosses the perimeter).
This feature is supported in mobile applications only.
The main geofence features are:
Geofence Manager
The Geofence Manager API is used to get notifications about the in or out state, depending on the geofence defined by the user.
Use the Geofence Manager API to:
- Create different types of geofences
- Get the current state
- Get in and out alerts
The geofence manager is set to GEOFENCE_MANAGER_ERROR_NONE if it is working correctly. The device can receive alerts about the geofence when a particular geofence service is started using the geofence_manager_start_geofence() function.
If the user revokes a permission to use the location information, the geofence manager state is set to GEOFENCE_MANAGER_PERMISSION_DENIED and the same error is returned back to the application invoking the geofence service.
Asynchronous geofence-related alerts (in or out) and event callbacks (a fence added or removed) are implemented with callback interfaces. The alerts are received using the GEOFENCE_STATE_UNCERTAIN, GEOFENCE_STATE_IN, and GEOFENCE_STATE_OUT values of the geofence_state_e enumerator.
Geofence Definition
The geofence definition defines the parameters of a geofence.
The 3 types of available geofences are geopoint, Wi-Fi, and Bluetooth. When creating the geofence, the type can be defined using the GEOFENCE_TYPE_GEOPOINT, GEOFENCE_TYPE_WIFI, and GEOFENCE_TYPE_BT values of the geofence_type_e enumerator.
The geopoint geofences require a geopoint and a radius, and the Wi-Fi and Bluetooth geofences require a MAC address. Based on the defined geofence type, the geofence manager creates the fence for the particular application.
Geofence Settings
Tizen provides the user a way of managing the geofence places and fence through the My places application. The following figure shows the default places and supported fences.
Figure: My places
My places controls the adding, removing, and updating of places and fences. Home, Office, and Car are the default places, and Map, Wi-Fi, and Bluetooth are the supported fence methods. Car supports only Wi-Fi and Bluetooth for a fence method.