Skip to content

Latest commit

 

History

History
144 lines (92 loc) · 6.25 KB

File metadata and controls

144 lines (92 loc) · 6.25 KB

Situm React Native SDK sample app

A sample React-Native application to start learning the power of Situm's React Native SDK Plugin.

npm npm TypeScript

Getting Started

home_preview map_preview navigation_preview

What's in here

Situm SDK is a set of utilities that allow any developer to build location based apps using Situm's indoor positioning system. Among many other capabilities, apps developed with Situm SDK will be able to:

  1. Obtain information related to buildings where Situm's positioning system is already configured: floor plans, points of interest, geotriggered events, etc.
  2. Retrieve the location of the smartphone inside these buildings (position, orientation, and floor where the smartphone is).
  3. Compute a route from a point A (e.g. where the smartphone is) to a point B (e.g. any point of interest within the building).

How to run the app

Step 1: Install the dependencies

The first step is to download this repo:

git clone https://github.com/situmtech/react-native.git

This repository uses yarn workspaces and yarn 4, so you will need to install Corepack and prepare yarn:

cd react-native/
npm install -g corepack
corepack enable
corepack prepare yarn@4.0.1 --activate

Then install the plugin dependencies alongside the example/ app dependecies as follows:

yarn install && yarn workspace example install
  • iOS In case you are using iOS, the last step is to install de dependencies specified in example/ios/Podfile with:
cd ios/
pod install

Step 2: Set your credentials

For this step you must create a situm account, so setup your account before continuing. After creating your situm account, you must set your credentials on the properties of src/situm.tsx, like so:

export const SITUM_EMAIL = "";
export const SITUM_API_KEY = "";
export const SITUM_BUILDING_ID = ""; // Identifier of the building to be loaded using MapView.
export const SITUM_API_DOMAIN = "https://api.situm.com";

You can use the contents of src/situm.tsx.example as example. For security reasons, the file situm.tsx is ignored in this repository.

NOTE: You should also fill the SITUM_BUILDING_ID variable so the MapView is able to work as expected. In case you haven't created POIs or paths yet, learn how to create these cartography elements.

Step 3: Run the app

Android

  • Run from command line:

    1. Initialize the metro terminal with $ yarn workspace example start.
    2. Then (in another terminal) compile and run this app in your device with $ yarn example android.
  • Run from Android Studio: Open example/android folder in Android Studio and run project.

iOS

  • Run from command line:

    1. Initialize the metro terminal with $ yarn workspace example start
    2. Then (in another terminal) compile and run this app in your device with $ yarn example ios.
  • Run from XCode: Go to example/ios folder and open SitumReactNativeExample.xcworkspace.

Documentation

More information on how to use the official React Native plugin and the set of APIs, the functions, parameters and results each function accepts and provides can be found in our Cordova JSDoc which shares interfaces.

Examples

In case you want to learn how to use our plugin, you may want to take a look at our code samples of the basics functionalities:

  • Showcasing our SDK
    • HomeScreen
      • Positioning: Learn how to start positioning and get the user location by using our listener.
      • Map Interaction: Learn how to interact with MapView from a different screen.
      • Fetch Resources: Learn how to fetch information about Situm cartography elements, such as buildings, POIs, and geofences.
    • WayfindingScreen
      • MapView: Learn how to integrate MapView for a complete wayfinding experience.
      • Learn how to interact with the map, such as selecting a POI or starting navigation.

Versioning

We use SemVer for versioning.

Please refer to CHANGELOG.md for a list of notables changes for each version of the library.

You can also see the tags on this repository.

Submitting Contributions

You will need to sign a Contributor License Agreement (CLA) before making a submission. Learn more here.

License

This project is licensed under the MIT - see the LICENSE file for details.

More information

More info is available at our Developers Page.

Support information

For any question or bug report, please send an email to support@situm.es