Get Started
This section covers installing the Map SDK into a React Native project and running it on Android and iOS.
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.
- Open
package.jsonand locate the dependency for@sovereignsolutions/ssmap-react-native. - Replace
YOUR_REGISTRY_USERNAMEwith your assigned registry username. - Replace
YOUR_REGISTRY_PASSWORDwith 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"
}
- Run your package manager install command (e.g.
yarn installornpm 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
- Show Map - initialize the SDK and render your first map
- Draw Shapes - add points, lines and polygons on the map
- Search - text search for locations
- What's Here - reverse geocode a coordinate
- Routing and Distance - find a route between waypoints
- Optimize Route - sequence multiple waypoints
- Cluster Layer - render large datasets with clustering
- Weather and Rainfall - live weather, forecasts and rainfall data
- Sample apps - reference source code on GitHub
Looking for background location collection instead? See the React Native Tracking SDK.