Quick start guide

Introduction

In this tutorial, we will guide you step by step to set up your first application using Situm Wayfinding Module. Before starting to write code, we recommend you to set up an account in our Dashboard, retrieve your API KEY and configure your first building.

  1. Go to the sign in form and enter your username and password to sign in.
  2. Go to the account section and on the bottom, click on "generate one" to generate your API KEY.
  3. Go to the buildings section and create your first building.
  4. Download Situm Mapping Tool Android application. With this application you will be able to configure and test Situm's indoor positioning system in your buildings.

Perfect! Now you are ready to develop your first indoor positioning application.

Installing pre-requisites

Configure React Native:

Firstly you need to setup react-native development environment. To get started please follow instructions under section React Native CLI Quickstart on this guide.

Installing the plugin

We assume that you have already created a react native application. There are some different ways to install the plugin:

1) Integrate plugin into project from npm:

$ yarn add react-native-situm-plugin

or

$ npm install --save react-native-situm-plugin

2) Integrate project from Github:

yarn add https://github.com/situmtech/situm-react-native-plugin.git

#OR

npm install --save https://github.com/situmtech/situm-react-native-plugin.git

Make sure to delete node_modules/ at project/node_modules/react-native-situm-plugin/node_modules.

Note: As of now the SDK is available only on Github. When updating the SDK, make sure to delete the existing one from node_modules/react-native-situm-plugin.

Note: if you want to fetch a particular branch of the repository simply append the branch name after the github URL as follow: shell npm install --save https://github.com/situmtech/situm-react-native-plugin.git#develop

* Please note that we are using Cocoapods in order to manage iOS dependencies, which means you might need to run pod repo update when trying to compile your app after updating our plugin

Android

You’ll need to add the follow repository in your project gradle file

allprojects {
    repositories {
        maven {
            url "https://repo.situm.es/artifactory/libs-release-local"
        }
    }
}

iOS

You’ll need to add depedency in PodFile

  target 'YourApp' do

    pod 'ReactNativeSitumPlugin', :path => '../node_modules/react-native-situm-plugin/ReactNativeSitumPlugin.podspec'

  end

You may need to add a Header Search Path: (screenshot)

  $(SRCROOT)/../node_modules/react-native-situm-plugin/lib/ios

Using the plugin

Accessing plugin object

In order to use the plugin in a React Native component all you need is the following:

import  SitumPlugin  from  "react-native-situm-plugin";

   SitumPlugin.fetchFloorsFromBuilding(building,
       (floors) => {...},
       (error) => {...},
   );

Methods

- initSitumSDK

Method that initialize the SDK. This method needs to be called once before using the rest of the methods.

SitumPlugin.initSitumSDK();

- setApiKey

Allows you to log in to your Situm Account. This key is generated in Situm Dashboard. Returns true if apiKey was set successfully, otherwise false

  SitumPlugin.setApiKey("your_email@domain.com", "YOUR_API_KEY");

- setUserPass

Provides user’s email and password.

  SitumPlugin.setUserPass("email@domain.com", "yourPassword");

Congratulations! Now you can start to code using Situm SDK. For more information and code samples, please check our React Native Getting Started in Github.