Monitor Woosmap assets

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

  1. Monitor Woosmap Search API assets by automatically generate geofence around its
  2. Forcing the refresh of monitored assets

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:

        WoosmapGeofenceManager.shared.setSearchAPICreationRegionEnable(enable: true)


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

        let dataPOI = DataPOI()
let dataRegion = DataRegion()

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

        // Set Woosmap API Private key
        WoosmapGeofenceManager.shared.setWoosmapAPIKey(key: WoosmapKey)

         // Set delegate of protocol POI 
        WoosmapGeofenceManager.shared.getLocationService().searchAPIDataDelegate = DataPOI()

        // Set delegate of protocol Region 
        WoosmapGeofenceManager.shared.getLocationService().regionDelegate = DataRegion()

        return true

        // Implement the SearchAPI delegate class for allowing the SDK to interact with Woosmap Search API

public class DataPOI: SearchAPIDelegate {
    public init() {}

    // handle search API response
    public func searchAPIResponse(poi: POI) {

    // handle search API error message
    public func searchAPIError(error: String) {


    // retrieve POI data
    public func readPOI() -> [POI] {
        return POIs.getAll()

    // retrieve a POI linked to a specific locationId
    func getPOIbyLocationID(locationId: String) -> POI? {
        return POIs.getPOIbyLocationID(locationId: locationId)

    // remove all POI from device database
    public func erasePOI() {



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

        import WoosmapGeofencing

public class DataRegion: RegionsServiceDelegate {

    // the didEnterPOIRegion() is called when a user enters in the geofence 
    public func didEnterPOIRegion(POIregion: Region) {
        // check first if the POIregion.origin is equal to "POI" 
        if POIregion.origin == "POI"
            // retrieve POI data from the device database
            if let POI = POIs.getPOIbyIdStore(idstore: POIregion.identifier ?? "") as POI? {
                print("Woosmap Geofencing Events: woos_geofence_entered_event - POI name:" +;
            else {
                // error: Related POI doesn't exist


In the didExitPOIRegion method, 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 assets

To define a custom radius for each asset, create a user property with the key “radius”. The expected type for this key is an integer.

It is possible to use the same radius value for all assets, use the setPoiRadius method:

        WoosmapGeofenceManager.shared.setPoiRadius(radius: 500.0)


Forcing the refresh of monitored assets

To refresh all POIs immediately without waiting for the automated update, you can use the following method:


Was this article helpful?
Have more questions? Submit a request