HERE Mobility offers a mobility platform solution to transportation service providers, businesses, and consumers. The platform consists of the HERE Mobility Marketplace and SDK packages.
The HERE Mobility Marketplace is a "broker" between transportation suppliers and consumers, which matches up ride requests with ride offers. Using the HERE Mobility SDK, you can enable your users to book and manage ride services within your app.
The HERE Mobility React Native SDK allows you to add HERE Mobility features to your app using the React Native framework. This allows you to develop your app in Javascript, and compile it for either the iOS or Android environments.
To install the HERE Mobility React Native SDK using the npm package manager, run the following command:
$ npm install react-native-here-mobility-sdk --save
To link the SDK to your project using the npm package manager, run the following commands:
$ npm i -g react-native-cli
$ react-native link react-native-here-mobility-sdk
To link the SDK to your project manually in an iOS environment:
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
. - Go to
node_modules
➜react-native-here-mobility-sdk
and addRNHereMobilitySdk.xcodeproj
. - In XCode, in the project navigator, select your project. Add
libRNHereMobilitySdk.a
to your project'sBuild Phases
➜Link Binary With Libraries
.
To link the SDK to your project manually in an Android environment:
- Open the file
android/app/src/main/java/[...]/MainActivity.java
- Add
import here.mobility.sdk.RNHereMobilitySdkPackage;
to the imports at the beginning of the file. - Add
new RNHereMobilitySdkPackage()
to the list returned by thegetPackages()
method.
- Append the following lines to
android/settings.gradle
:include ':react-native-here-mobility-sdk' project(':react-native-here-mobility-sdk').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-here-mobility-sdk/android')
- Add the following line to the dependencies block in
android/app/build.gradle
:compile project(':react-native-here-mobility-sdk')
Note: HereMobilitySDK is a dynamic framework. To use it, you must specify
use_frameworks!
in your project's podfile.
To configure and initialize HereMobilitySDK in an iOS environment:
-
Follow the instruction in the HereMobilitySDK Installation Guide
-
Run the following command:
$ cd (node_modules/react-native-here-mobility-sdk/ios && pod install)
-
Open your project's workspace; build and run your project.
To configure and initialize HereMobilitySDK in an Android environment:
-
Open your project in Android Studio.
-
In your project’s root
build.gradle
, add the following lines to your repositories section:buildscript { repositories { ... maven { url 'https://maven.google.com/' name 'Google' } } } allprojects { repositories { ... maven { url "https://mobility.bintray.com/sdk" } maven { url 'https://maven.google.com/' name 'Google' } } }
-
Follow the instruction in the HereMobilitySDK Installation Guide, steps 3.i through 3.viii.
To use the HERE Mobility SDK, add the following line to your app's Javascript code. Use the HereMobilitySDKDemand functions for ride booking and management.
const { HereMobilitySDKDemand , HereMobilitySDK } = require("react-native-here-mobility-sdk");