Skip to content

Latest commit

 

History

History

SampleApp

React Native: NavSDK Library Sample App

Description

This contains a sample application to showcase the functionality of the NavSDK library for React Native.

Setup

  1. First, make sure you go through the setup from the main README.

  2. Run this command npm install react-native from the root of SampleApp folder. This will generate the node_modules from this sample app.

    • In case you get a Permission denied (publickey). error here, make sure that you have authenticated with Github in your terminal.
  3. Run this in SampleApp's root directory:

    npm install --save https://github.com/googlemaps/react-native-navigation-sdk

  4. Open the SampleApp/android folder in Android Studio and add your api key in local.properties by adding a line like this:

  5. Using your preferred terminal, go to SampleApp/ios folder and run the command below.

    pod install

  6. In your Google cloud console, add the Google API key to the project. Add this newly created API key to the Info.plist file inside SampleApp/ios/SampleApp/.

    <key>API_KEY</key>
    <string>Your API KEY</string>
  7. To run the sample app, go to the root folder of the sample app and run the command below according to platform using your preferred terminal.

    • Running in Android: npx react-native run-android
    • Running in iOS: npx react-native run-ios
  8. After the app initializes, accept the terms of services. You should see a map loaded in background if you have used the right API key.

Android

  1. On your Emulator, go to App Info for the installed app, then Permissions > Location and allow location for the app.

  2. Restart the app, now the Navigation view should be displayed instead of the map.