08 – Remote configuration

One of the more common challenges with the Situm SDK is using the correct configuration. For instance, you may want to use the GPS while positioning indoor if your building has good signal inside. Knowing what is the best configuration normally takes time and various iterations. Before the version 2.69.0 you had to recompile your app changing the configuration programmatically. If you already have users they have to update it and this process takes time. The Remote Configuration feature has changed this. You can use it to make changes instantly and for all of your users.

Changing the configuration #

You can change the Situm SDK Configuration using the Remote Configuration panel available on the “My organization” menu, as it is shown in image below.

Mobile SDK Configuration

Right now this panel only has positioning configuration but we are working to add more. When you are done with the changes you just have to save them and, if you have the SDK configured to use the Remote Configuration, the next time you start the positioning the changes will be applied.

Sensors & Positioning Options
Buildings detector & Outdoors
Advanced options

Configuring the Android SDK #

To use this functionality you need to be at least in version 2.69.0. First, you need to set the usage of the Remote Configuration to true, like this:

SitumSdk.configuration().setUseRemoteConfig(true);

This instruction only needs to be performed once, not every time you request location updates. You can place it on the same file of other Situm configuration like credentials.

After that, when you want to start the positioning just use an empty LocationRequest.

SitumSdk.locationManager().requestLocationUpdates(new LocationRequest.Builder().build(), locationListener);

And that’s all. Now when you start the positioning the Situm SDK will check if the configuration has been updated and, if that’s the case, the new one will be used.

In the case that you don’t have connection when the SDK is downloading the configuration an error will be thrown. This is the same behavior as when the download of other necessary information (like the buildings or the model of the building) fails.

Override the Remote Configuration #

You can override specific parameters of the configuration if you want. We normally recommend to just use the Remote Configuration but there may be some cases when you may want to override them. Imagine that you have more than one building in your account, you could use the Global Mode but the logic of the application requires the user to select between them, so in this case one option is to wait until the user selects the building and use the Building Mode.

LocationRequest.Builder locationRequestBuilder = new LocationRequest.Builder(); // Empty location request builder
locationRequestBuilder.setBuildingIdentifier("1234"); // Local changes overriding remote configuration values

SitumSdk.locationManager.requestLocationUpdates(locationRequestBuilder.build(), locationListener); // Start location with all remote configuration parameters but building identifier (specified programmatically)

When there is more than one configuration, the local always have priority over the Remote Configuration. Keep in mind that this is done for each individual parameter. In the previous example only the building identifier will use the Local Configuration, the other parameters are the ones in the Remote Configuration.

As you can see using the Remote Config feature is not mandatory and you can always override it programmatically; but please keep in mind that when you change parameters programmatically you loose some of the benefits of the feature, the most important one being able to deploy changes in configuration remote and instantly to all your customers base.

Get the Remote Configuration #

You can use the Situm SDK CommunicationManager to get the Remote Configuration by calling the method fetchRemoteConfig. This method will asynchronously get a RemoteConfig object which encapsulates all the objects that can be configured remotely using the dashboard. At this moment that is the case of only a LocationRequest, but is expected to grow in line with subsequent remote settings.

Configuring the iOS SDK #

To use this functionality you need to be at least in version 2.52.0. First, you need to set the usage of the Remote Configuration to true, like this:

SITServices.setUseRemoteConfig(true);

This instruction only needs to be performed once, not every time you request location updates. You can place it on the same file of other Situm configuration like credentials (for example, AppDelegate.swift).

After that, when you want to start the positioning just use an empty LocationRequest.

SITLocationManager.sharedInstance().requestLocationUpdates(nil)

And that’s all. Now when you start the positioning the Situm SDK will check if the configuration has been updated and, if that’s the case, the new one will be used.

In the case that you don’t have connection when the SDK is downloading the configuration an error will be thrown. This is the same behavior as when the download of other necessary information (like the buildings or the model of the building) fails.

Override the Remote Configuration #

Starting from version 2.52.3 os Situm SDK for iOS you can override specific parameters of the configuration if you want. We normally recommend to just use the Remote Configuration but there may be some cases when you may want to override them. Imagine that you have more than one building in your account, you could use the Global Mode but the logic of the application requires the user to select between them, so in this case one option is to wait until the user selects the building and use the Building Mode.

var locationRequest = LocationRequest() // Empty location request
locationRequest.buildingId = "1234" // Local changes overriding remote configuration values

SITLocationManager.sharedInstance().requestLocationUpdates(request) // Start location with all remote configuration parameters but building identifier (specified programmatically)

When there is more than one configuration, the local always have priority over the Remote Configuration. Keep in mind that this is done for each individual parameter. In the previous example only the building identifier will use the Local Configuration, the other parameters are the ones in the Remote Configuration.

As you can see using the Remote Config feature is not mandatory and you can always override it programmatically; but please keep in mind that when you change parameters programmatically you loose some of the benefits of the feature, the most important one being able to deploy changes in configuration remote and instantly to all your customers base.

Get the Remote Configuration #

You can use the Situm SDK CommunicationManager to get the Remote Configuration by calling the method fetchRemoteConfig. This method will asynchronously get a RemoteConfig object which encapsulates all the objects that can be configured remotely using the dashboard. At this moment that is the case of only a LocationRequest, but is expected to grow in line with subsequent remote settings.

Configuring the React Native plugin #

To use this functionality you need to be at least using the version 0.0.13 of the plugin. First, you need to set the usage of the Remote Configuration to true, like this:

SitumPlugin.setUseRemoteConfig(true, (res: any) => {});

This instruction only needs to be performed once, not every time you request location updates. You can place it on the same file of the other Situm configuration like credentials.

After that, when you want to start the positioning just use an empty LocationRequest.

var locationRequest = null;
SitumPlugin.startPositioning(locationRequest, (res: any) => {}, (err: any) => {});

And that’s all. Now when you start the positioning the Situm SDK will check if the configuration has been updated and, if that’s the case, the new one will be used.

In the case that you don’t have connection when the SDK is downloading the configuration an error will be thrown. This is the same behavior as when the download of other necessary information (like the buildings or the model of the building) fails.

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