03 – Architecture & general usage

Situm WYF is an UX component. Therefore, its behaviour strips down to:

  • Showing itself inside an UX container (e.g. an Activity/Fragment in Android or a Component in React).
  • Receiving user interactions that happen within that container.
  • Informing the app about those interactions (e.g. user has touched a button) as well as other events happening within Situm WYF.
  • Receiving commands from the app, with the objective of modifying the module behaviour (e.g. center the view on a certain POI) or visualization properties (e.g. hide the floor selector).

Situm WYF architecture components #

Situm WYF most important element is the SitumMap (Android, iOS). The SitumMap is an object in Android, and a protocol in iOS, whose implementation delivers all the SitumWYF functionality described above (displaying itself in the UX, receiving user interactions, etc.). Underneath, the SitumMap component is provided by the SitumMapsLibrary (Android, iOS). In Android, this library component inherits from the SitumMap. In iOS, it implements the SitumMap protocol.

The developer can instantiate and operate the SitumMapsLibrary (which implements all the SitumMap methods) to control the SitumMap behaviour on the fly. This includes:

  • Showing / hiding certain UX elements (e.g. floor selector, POI search bar…).
  • Changing the map view (e.g. defining where the view should be centered or what portion of the venue should be visible).
  • Setting listener methods that will receive events generated by SitumWYF (or by the user).
  • Start / stop positioning and or navigation.
  • Interacting programmatically with cartography elements (e.g. highlighting a POI).
  • etc.

When it is built, this SitumMapsLibrary receives a LibrarySettings component (Android, iOS), which allows the developer to configure static parameters & behaviour such as:

  • Credentials to be used by SitumWYF.
  • Whether or not Remote Configuration should be used.
  • Whether or not the Organization Theme should be taken into account to customize the look & feel of Situm WYF (colours & logos).
  • Initialization display properties such as the initial zoom, whether the POI name should be drawn on top of the POI icons…
  • etc.

The SitumMap can be shown in your app following two different approaches:

  • Programmative approach (native Android/iOS only). You may indicate to the SitumMapsLibrary the UX component where it should render itself. This way, you’ll have great flexibility regarding where & how SitumWYF will be rendered. You’ll also be able to configure SitumWYF behaviour with the greatest granularity.
  • Declarative approach. We also provide an UI view (SitumMapView in Android, SitumView in iOS and MapView in React Native) that can be directly rendered within your app’s UI. Using this view is easy and convenient, and while it allows to configure certain parameters, it’s less flexible than the programmative counterpart.

Using Situm WYF programmatically (native Android/iOS) #

Please follow the Quickstart Guide (Android, iOS) first, which explains briefly how to use SitumWYF programmatically. In essence, you’ll need to declare an UI component in your app and load the SitumMap in that component using the LibrarySettings object.

For example, in Android you can declare a FrameLayout in your activity_main.xml:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <FrameLayout
        android:id="@+id/maps_library_target"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        />

</androidx.constraintlayout.widget.ConstraintLayout>

Then, you may load the SitumMap in this UX component like this:

public class MainActivity extends AppCompatActivity {
    SitumMapsLibrary mapsLibrary = null;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        //Create LibrarySettings and set the account credentials
        LibrarySettings librarySettings = new LibrarySettings();
        librarySettings.setApiKey("user@email.es", "APIKEY");

        //Load the SitumMapsLibrary into the target UX component
        //with the appropriate library settings
        mapsLibrary = new SitumMapsLibrary(R.id.maps_library_target, this, librarySettings);
        mapsLibrary.load();

    }
}

You may extend a bit the example above in order to include more static (before the component is loaded) and dynamic (at run-time) configurations:

public class MainActivity extends AppCompatActivity {

    SitumMapsLibrary mapsLibrary = null;
    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        LibrarySettings librarySettings = new LibrarySettings();
        librarySettings.setApiKey("qa.acanedo2@situm.es", "6409382ccd7a08894697ab8f8e8451f60b4284d97d3eb634ba450927d33f8f77");

        //Static configurations
        //Don't show the POI search view
        librarySettings.setHasSearchView(false);
        //Show the POI names on top of their icons
        librarySettings.setShowPoiNames(true);
        
        mapsLibrary = new SitumMapsLibrary(R.id.maps_library_target, this, librarySettings);
        
        //Set a listener method to be informed when SitumWYF is ready
        mapsLibrary.setSitumMapsListener(situmMapsListener);
        mapsLibrary.load();


    }

    //This listener will be called (onSuccess) when SitumWYF has
    //been loaded
    SitumMapsListener situmMapsListener = new SitumMapsListener() {
        @Override
        public void onSuccess() {

            //At this point, we can establish dynamic configurations
            //These configurations can be applied at any moment
            //during run-time
            mapsLibrary.enableOneBuildingMode("10194");
            mapsLibrary.setFloorsListVisible(false);
        }

        @Override
        public void onError(int i) {

        }
    };
}

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