Skip to content

Login

Required

Needed by every integration.

Introduction

Before using any of the Oriient Indoor Positioning System (IPS) features in your application, it is essential that you first log in.

Attention

Keep in mind that the login process is an asynchronous command, requiring an active Internet connection.

Additionally, it is crucial to use a pair of API Keys (Development and Production) for login purposes. Beware that there's an assertion in place which may cause the application to terminate if you use a Production API Key while debugging via Android Studio or any other debugging tool.

Implementation

Perform Login

Call IPSCore.login() with your credentials to login.

IPSCore.login(username, apiKey, ips, new IPSLoginListener() {
    @Override
    public void onLogin(@NonNull List<IPSSpace> list) {
        Log.d(TAG, "onLogin() called with: list = [" + list + "]");
    }

    @Override
    public void onLoginError(@NonNull IPSError ipsError) {
        Log.e(TAG, "onLoginError: " +ipsError.getMessage());
    }
});

Note

All location-based content, including maps, is categorized by 'Spaces'. By default, the Framework will utilize your first Space, which typically is the only Space available. However, as Spaces can be modified through the dashboard or REST API, Oriient recommends explicitly selecting one after login. See Spaces below.

Perform Login for on-cart devices

For on-cart devices, it's possible to store calibration data on Oriient back-end in order to perform calibraion only once per device. To do this, call IPSCore.login() with your credentials to login and unique device ID that can persist between app installations:

IPSCore.login(username, apiKey, ips, uniqueDeviceId, new IPSLoginListener() {
    @Override
    public void onLogin(@NonNull List<IPSSpace> list) {
        Log.d(TAG, "onLogin() called with: list = [" + list + "]");
    }

    @Override
    public void onLoginError(@NonNull IPSError ipsError) {
        Log.e(TAG, "onLoginError: " +ipsError.getMessage());
    }
});

Note

Discuss usage of this approach with Oriient integration team

Pre-loading the data required for positioning (optional)

Upon successful login, you have the option to pre-load the data necessary for positioning within a specific building. This step requires a specified buildingId and should be executed only if you have prior knowledge of the building where the user will be using the feature. Otherwise, this step can be omitted. Generally, this is an optional process. If not implemented, the data will be automatically downloaded when the user is inside the geofence, or at a later stage when you invoke IPSPositioning.startPositioning(). See Positioning Guide for more reference.

To start the data pre-loading, simply call the following endpoint:

IPSDataManager.prepareData(buildingId)

The next step is also optional - you may implement the data status observer IPSDataStatusObserver, to observe the status of the data downloading, see an example from our demo app:

private inner class DataStatusObserver : IPSDataStatusObserver {
    override fun onDataStatusChanged(buildingId: String, @IPSDataStatus newStatus: Int) {
        isPositioningDataPreloading.value = when (newStatus) {
            IPSDataStatus.PREPARING -> true
            IPSDataStatus.REQUIRES_PREPARATION,
            IPSDataStatus.READY -> false
            else -> false
        }
    }

    override fun onDataPreparationFailed(buildingId: String, error: IPSError) {
        Log.d(
            TAG,
            "onDataPreparationFailed() called with: buildingId = $buildingId, error = $error"
        )

        isPositioningDataPreloading.value = false
        positioningDataPreloadingError.tryEmit(error.toAppError())
    }
}

Lastly, add the observer via:

IPSDataManager.addDataStatusObserver(dataStatusObserver)

Spaces

All the location content in Oriient IPS, including maps, is grouped by Spaces. The Spaces concept facilitates control over which maps and location content will be accessible through the IPS SDK. The Space object in the system is represented by the IPSSpace object.

Selected Space

Currently selected Space ID is available using the IPSCore.getSpace() method. In case the login command was not executed, the resulting value will be null.

Switching Spaces

You can switch between currently available spaces using IPSCore.setSpaceId().

Recommendation

Selecting a space immediately following execution of the login command is recommended. This holds true even if there is only one Space currently available for your API key.