Situm SDK allows you to choose between two positioning modes: Building and Global Mode. Choosing one or the other is pretty simple: you may do it by using the LocationRequest.Builder().buildingIdentifier method. 



1. Building Mode


This mode allows you to locate the user within a specific building. Please read this article to know the specifics about how this mode works and how it should be used.


In order to activate this mode, all you need to do is specify the building identifier when you build the LocationRequest. Then, call the requestLocationUpdates method as always.


//Build LocationRequest by passing the BUILDING_IDENTIFIER
LocationRequest locationRequest = new LocationRequest.Builder()
                .buildingIdentifier("BUILDING_IDENTIFIER")
                .build();

//Start the positioning. Locations will be passed (via callback) to the LocationListener previously declared
SitumSdk.locationManager().requestLocationUpdates(locationRequest, locationListener);

You may visit our Github for a full working example.



2. Global Mode


This mode detects automatically the calibrated building where the user is and provides her Indoor Position. If the user is not in a calibrated building, the Outdoor Location will be rendered.  Please read this article to know the specifics about how this mode works and how it should be used. 


Using the Global Mode is straightforward: just build a LocationRequest without specifying a building identifier and start positionining. You may also visit our Github for a full working example.


//Build LocationRequest without passing any BUILDING_IDENTIFIER
LocationRequest locationRequest = new LocationRequest.Builder().build();

//Start the positioning. Locations will be passed (via callback) to the LocationListener previously declared
SitumSdk.locationManager().requestLocationUpdates(locationRequest, locationListener);


As explained in this Section, the Global Mode allow you to choose among three available building detectors.  The previous snippet, for instance, will use the default detector (GPS based detector).  All tdetectors can be selected by passing to the method LocationRequest.Builder().buildingDetector an appropriate OutdoorLocationOptions.BuildingDetector value.


GPS based building detector (default)


This is the default detector. Essentially, when using this detector, the user will be geolocated in the nearest building from those within a certain maximum distance. A complete description of this mode can be found here.


Selecting this detector is pretty simple:


//Option 1. Default behaviour: do not specify any OutdoorLocationOptions value
LocationRequest locationRequest = new LocationRequest.Builder().build();

//Option 2. Use the OutdoorLocationOptions.BuildingDetector.GPS_PROXIMITY
OutdoorLocationOptions outdoorLocationOptions = new OutdoorLocationOptions.Builder().buildingDetector(OutdoorLocationOptions.BuildingDetector.GPS_PROXIMITY).build();
        LocationRequest locationRequest = new LocationRequest.Builder().outdoorLocationOptions(outdoorLocationOptions).build();

You may visit our Github for a full working example.



WIFI/BLE based building detector (RECOMMENDED)


This is the recommended detector. Essentially, when using this detector, the user user will be geolocated inside the building whose calibration signals match better with those perceived by the user smartphone. A complete description of this mode can be found here.


You may choose to use  WIFI & BLE signals simultaneously... 


OutdoorLocationOptions outdoorLocationOptions = new OutdoorLocationOptions.Builder().buildingDetector(OutdoorLocationOptions.BuildingDetector.WIFI_AND_BLE).build();
        LocationRequest locationRequest = new LocationRequest.Builder().outdoorLocationOptions(outdoorLocationOptions).build();


... just WiFi...


OutdoorLocationOptions outdoorLocationOptions = new OutdoorLocationOptions.Builder().buildingDetector(OutdoorLocationOptions.BuildingDetector.WIFI).build();
        LocationRequest locationRequest = new LocationRequest.Builder().outdoorLocationOptions(outdoorLocationOptions).build();


... or just BLE ...


OutdoorLocationOptions outdoorLocationOptions = new OutdoorLocationOptions.Builder().buildingDetector(OutdoorLocationOptions.BuildingDetector.BLE).build();
        LocationRequest locationRequest = new LocationRequest.Builder().outdoorLocationOptions(outdoorLocationOptions).build();


Always on mode (Android only) 


The standard WiFi/BLE detector may not be able to provide a fast building transition if the buildings between which the user moves are too close. In these situation, you may activate the "Always On Mode" for the this detector. See this article for an explanation of how it works.


The following snippet provides an example on how to configure this mode:


//It also works if you use the BuildingDetector.WIFI or BuildingDetector.BLE
OutdoorLocationOptions outdoorLocationOptions = new OutdoorLocationOptions.Builder().
                buildingDetector(OutdoorLocationOptions.BuildingDetector.WIFI_AND_BLE).
                scansBasedDetectorAlwaysOn(true).build();
LocationRequest locationRequest = new LocationRequest.Builder().outdoorLocationOptions(outdoorLocationOptions).build();


GPS + WIFI/BLE based building detector


This mode is only available when using the Uncalibrated GPS Indoor positioning mode.  The user will be geolocated inside the building where: 1) Calibration signals match better with those perceived by the user smartphone, and/or 2) GPS signal falls within one of the GPS-configured geofences of the building. In other words, this mode is just like the WiFi/BLE detector explained in the previous section, but it also will consider that the user is within a certain building if she is within one of those special geofences of that building.   


To configure this mode, you must:

  1. Configure the WiFi/BLE based detector of your choosing (depending on whether you want to use WiFi, BLE, or WIFI & BLE signals to match with those recorded during the calibration step).
  2. Activate the use of GPS positioning by means of the LocationRequest.useGps method.
  3. Configure the building geofences as explained in this article.


OutdoorLocationOptions outdoorLocationOptions = new OutdoorLocationOptions.Builder().buildingDetector(OutdoorLocationOptions.BuildingDetector.WIFI_AND_BLE)
.useGeofencesInBuildingSelector(true).build();
        LocationRequest locationRequest = new LocationRequest.Builder().useGps(true).outdoorLocationOptions(outdoorLocationOptions).build();


Always on mode (Android only) 



This detector also supports the Always On Mode.  The following snippet shows an example on how to activate it:


OutdoorLocationOptions outdoorLocationOptions = new OutdoorLocationOptions.Builder().
                buildingDetector(OutdoorLocationOptions.BuildingDetector.WIFI_AND_BLE).
                useGeofencesInBuildingSelector(true).
                scansBasedDetectorAlwaysOn(true).build();

LocationRequest locationRequest = new LocationRequest.Builder().outdoorLocationOptions(outdoorLocationOptions).build();