Skip to main content

Get Started

This section covers installing the Map SDK into a React Native project and running it on Android and iOS.

info

This section assumes a React Native project bootstrapped with @react-native-community/cli, such as the sample app.


Prerequisites and requirements​

  • Access Key: an API key issued during onboarding - see Contact us to request access.
  • Private registry credentials: a username and password to pull the private package, issued during onboarding.
  • Complete the React Native Set Up Your Environment guide before proceeding.

Installing the Sovereign Solutions Map SDK​

To install the custom Sovereign Solutions map library, you need to provide your private registry credentials in the package.json file.

  1. Open package.json and locate the dependency for @sovereignsolutions/ssmap-react-native.
  2. Replace YOUR_REGISTRY_USERNAME with your assigned registry username.
  3. Replace YOUR_REGISTRY_PASSWORD with your assigned registry password.

It should look something like this:

"dependencies": {
"@sovereignsolutions/ssmap-react-native": "https://username:[email protected]/artifactory/ssmap-reactnative/sovereignsolutions-ssmap-react-native-0.0.3.tgz"
}
  1. Run your package manager install command (e.g. yarn install or npm install).

Getting started​

Step 1: Start Metro​

First, you will need to run Metro, the JavaScript build tool for React Native.

To start the Metro dev server, run the following command from the root of your React Native project:

# Using npm
npm start

# OR using Yarn
yarn start

Step 2: Build and run your app​

With Metro running, open a new terminal window/pane from the root of your React Native project, and use one of the following commands to build and run your Android or iOS app.

Android​

# Using npm
npm run android

# OR using Yarn
yarn android

iOS​

For iOS, remember to install CocoaPods dependencies (this only needs to be run on first clone or after updating native deps).

The first time you create a new project, run the Ruby bundler to install CocoaPods itself:

bundle install

Then, and every time you update your native dependencies, run:

bundle exec pod install

For more information, see the CocoaPods Getting Started guide.

# Using npm
npm run ios

# OR using Yarn
yarn ios

If everything is set up correctly, you should see your new app running in the Android Emulator, iOS Simulator, or your connected device. This is one way to run your app - you can also build it directly from Android Studio or Xcode.


Next steps​


Looking for background location collection instead? See the React Native Tracking SDK.