Monitor Woosmap assets

Monitor Woosmap assets with Geofence using Android SDK and Woosmap Search API

  1. Monitor Woosmap Search API assets by automatically generate geofence around its

Monitor Woosmap Search API assets by automatically generate geofence around its

You need a Private API key to request the Woosmap Search API.

To monitor more than 10 points of interest, it is recommended to use Woosmap Search API and load these POIs as Woosmap assets.

Indeed, Search requests help monitoring the approach to some assets you want to monitor. Assets monitoring starts by monitoring the 20 nearest assets and the SDK regularly refresh this list of 20 assets by requesting the Woosmap Search API

To create a circular region around the nearest result of the Search API request, use the passive tracking profile or enable the tracking properties searchAPICreationRegionEnable:

WoosmapSettings.searchAPICreationRegionEnable = true

But first you have to set keys and set a listener to monitor result of the SearchAPI request :

@Override
protected void onCreate(Bundle savedInstanceState) {
    // Instanciate woosmap object
    this.woosmap = Woosmap.getInstance().initializeWoosmap(this);

    // Set private Woosmap key API - It is mandatory for requesting Woosmap Search API and monitor Woosmap Asset
    WoosmapSettings.privateKeyWoosmapAPI = woosmapKey;

    // Instanciate the WoosRegionLogReadyListener to monitor geofence events
    this.woosmap.setRegionLogReadyListener( new WoosRegionLogReadyListener() );

    // Passive tracking - Medium accuracy - low power battery usage - no permanent notification in background
    this.woosmap.startTracking( Woosmap.ConfigurationProfile.passiveTracking );
}

RegionLog callbacks are triggered each time a user enters or exits a geofence:

public class WoosRegionLogReadyListener implements Woosmap.RegionLogReadyListener {
    public void RegionLogReadyCallback(RegionLog regionLog) {

        // retrieve POI data from the device database
        POI poi = WoosmapDb.getInstance(getApplicationContext()).getPOIsDAO().getPOIbyStoreId(regionLog.idStore);
        Log.d("WoosmapSDKEvents", "Woosmap Geofencing Events:" + regionLog.eventName + " - POI name:" + poi.name);
}

You can use eventName data to distinguish between enter event (eventName = "woos_geofence_entered_event") and exit event (eventName = "woos_geofence_exited_event").

In the woos_geofence_exited_event, an additional data is provided by the regionLog object: spentTime It represents the time spent in the geofence between the entry event and the exit event.

Radius of POI

Manually define the radius value:

WoosmapSettings.poiRadius = 500;

or choose the user_properties subfield that corresponds to radius value of the Geofence:

WoosmapSettings.poiRadiusNameFromResponse = "radiusPOI";
Was this article helpful?
Have more questions? Submit a request