Monitor user's Visits

How to track user’s Visits and identify his Zone of interest on Android.

  1. Collect user’s Visits
  2. Zone of Interest (ZOI)

Get the location and the time spent when a user is visiting places. These use cases are explained in the Visit and ZOI documentation.

Collect user’s Visits

Set up for Visits monitoring

The first step in collecting Visits is to set VisitReadyListener, this should be done in your mainActivity on the method onCreate. It is recommended to use the visitsTracking profile to monitor visits and identify ZOI. You can also enable the visitEnable setting if you don’t want to use a preset tracking profile.

java
        @Override
protected void onCreate(Bundle savedInstanceState) {

    // [...] //

    this.woosmap.setVisitReadyListener (new WoosVisitReadyListener ());

    this.woosmap.startTracking( Woosmap.ConfigurationProfile.visitsTracking );
}

    

Woosmap Visit Ready Listener

Create a listener connected to the interface Woosmap.VisitReadyListener and set a callback to retrieve Visits event. This callback is triggered when a visit is identified.

java
        public class WoosVisitReadyListener implements Woosmap.VisitReadyListener
{
    public void VisitReadyCallback(Visit visit)
    {
        // this method is called when a visit is collected
    }
}

    

Zone of Interest (ZOI)

Set up for ZOI monitoring

ZOIs are built from visits, grouped by proximity. The Geofencing SDK implements the Fast Incremental Gaussian Mixture Model of classification Algorithm FIGMM to build and update the ZOI according to visits recurrence over time.

You can recover the ZOIs generated by making a request to the database.

java
        ZOI[] ZOIList = WoosmapDb.getInstance(mContext, true).getZOIsDAO().getAllZois();

    

Each ZOI includes the following information:

Field name Type Description
idVisits ArrayList The list of id visits included in this ZOI.
latMean double The latitude of the center of the ZOI (useful if you need to qualify the place of the visit with a search request over POIs or assets)
lngMean double The longitude of the center of the ZOI (useful if you need to qualify the place of the visit with a search request over POIs or assets)
startTime long The entry date for the first ZOI visit.
endTime long The exit date of the last ZOI visit
duration long The duration of all the accumulated visits of the ZOI
wktPolygon String This is the Well-known text representation of geometry of the ZOI polygon.
Was this article helpful?
Have more questions? Submit a request