05 – External provider locations

You may want to use the majority of functionalities that Situm has to offer (cartography, routes, maps…), but not our positioning system. 2 typical examples:

  • You have your own positioning system and you want to leverage on our maps & routes.
  • You want to inject fake locations so you can test how Situm SDK & WYF would behave (e.g. how geolocation will be visualized, how routes would be computed, etc.).

The External Provider Locations functionality allows you to do that. Instead of computing the geolocation, the SDK will rely on the ones you provide. Aside from that, everything will work as usual with a few exceptions:

  • This mode only works with Building mode (right now it is not compatible with the Global mode).
  • When this mode is enabled the SDK doesn’t scan WiFi, BLE and GPS.
  • This mode is only available for Android SDK v 2.78.0 onwards and Situm WYF for Android for v 0.18.0 onwards.

How to enable this mode #

It’s pretty easy: you just need to call one method after you do “SitumSdk.init(context)”. See below:

SitumSdk.init(context);

//The SDK will not compute internal locations, but rely on external ones
SitumSdk.configuration().useExternalLocations(true);
//The SDK will not compute internal locations, but rely on external ones
SITServices.setUseExternalLocations(true)

How to use it #

After enabling this mode you need to start the positioning like you would normally do:

//Important! The LocationRequest needs to contain your buildingId, this mode doesn't work without it
LocationRequest locationRequest = new LocationRequest.Builder()
        .buildingIdentifier("BUILDING_ID")
        .build();
        
//Start positioning as always
SitumSdk.locationManager().requestLocationUpdates(locationRequest, locationListener);
//Set the delegate that will receive the location updates
SITLocationManager.sharedInstance().addDelegate(self)
//Important! The LocationRequest needs to contain your buildingId, this mode doesn't work without it
let locationRequest = SITLocationRequest(buildingId: "BUILDING_ID")
//Start positioning as always
SITLocationManager.sharedInstance().requestLocationUpdates(locationRequest)

After this, you just need to add your location. You can do it as many times as you want. If you stop calling this method the last location will be the last you have added.

Android

//You may call the addExternalLocation() methos everytime you want to inject a new location
//The SDK will notify each location added through the LocationListener
SitumSdk.locationManager().addExternalLocation(new ExternalLocation.Builder("BUILDING_ID","FLOOR_ID", 1.23456, 2.34567).build());
//You may call the addExternalLocation() methos everytime you want to inject a new location
//The SDK will notify each location added through the LocationListener
let externalLocation = SITExternalLocation(buildingIdentifier: "BUILDING_ID", floorIdentifier: "FLOOR_ID", latitude: 1.23456, longitude: 2.34567)
SITLocationManager.sharedInstance().add(externalLocation)

Other things to keep in mind #

  • Don’t update the location more than once per second (otherwise, just the last one will be taken into account).
  • If you’re using this method to simulate the SDK behaviour, it’s common to read the external locations from an external file (just code a simple file reader and you’re good to go).

Subscribe to our newsletter

BASIC INFORMATION ON DATA PROTECTION

Data controller: SITUM TECHNOLOGIES, S.L.
Contact: Data controller: situm@situm.es
Responsible for protection: dpo@situm.es
Purpose and legal basis: To manage the sending of SITUM newsletters only with consent.
Legitimation: Express consent of the interested party.
Recipients: The data will not be passed on to third parties with the exception of legal obligations.
Retention period: As long as the interested party remains subscribed to the newsletter (a link to unsubscribe will be available in each newsletter sent by Situm).
Rights: The interested party may at any time revoke their consent, as well as exercise their rights of opposition, access, conservation, rectification, limitation, deletion of data and not be subject to a decision based only on automated data processing, by writing to SITUM at the addresses indicated.
Additional Information: You can consult additional and detailed information on Data Protection in our privacy policy.

Please, download your copy here

Thank you for downloading our whitepaper. Please do not hesitate to contact us if you would like to know more about how our solutions can help your business. Download whitepaper


Close window