Skip to main content

Sample App

OMH Maps Sample Application

The Sample App showcases the capabilities of the OMH Maps plugins, featuring all available providers for the specific operating system.

Getting Started

Note: Make sure you have completed the React Native - Environment Setup instructions till "Creating a new application" step, before proceeding.

Step 1 Setup

Clone the repo and install all required dependencies

git clone https://github.com/openmobilehub/react-native-omh-maps.git
cd apps/sample-app
# using yarn
yarn install

Create secrets files:

Create a new file in apps/sample-app/ios called: Secrets.xcconfig and add Google Maps API key like this:

GOOGLE_MAPS_API_KEY = YOUR_GOOGLE_MAPS_API_KEY

Create a new file in sample-app/android called local.properties and add API keys for Google Maps, Mapbox, Azure Maps like this:

GOOGLE_MAPS_API_KEY = YOUR_GOOGLE_MAPS_API_KEY
MAPBOX_PUBLIC_TOKEN = YOUR_MAPBOX_MAPS_API_KEY
AZURE_MAPS_SUBSCRIPTION_KEY = YOUR_AZURE_MAPS_API_KEY

Note: To run iOS application, there are two additional steps:

cd sample-app/
bundle install
bundle exec pod install --project-directory=./ios

Step 2: Start your Application

  • Let Metro Bundler run in its own terminal.
#start Metro
yarn start
  • Run the app: Open a new terminal from the root of your React Native project. Run the following command to start your Android or iOS app:

For Android

# using Yarn
yarn android

For iOS

# using Yarn
yarn ios

If everything is set up correctly, you should see your new app running in your Android Emulator or iOS Simulator shortly provided you have set up your emulator/simulator correctly.

This is one way to run your app — you can also run it directly from within Android Studio and Xcode respectively.

Step 3: Modifying your App

Now that you have successfully run the app, let's modify it.

  1. Open App.tsx in your text editor of choice and edit some lines.

  2. For Android: Press the R key twice or select "Reload" from the Developer Menu (Ctrl + M (on Window and Linux) or Cmd ⌘ + M (on macOS)) to see your changes!

    For iOS: Hit Cmd ⌘ + R in your iOS Simulator to reload the app and see your changes!

Congratulations! 🎉

You've successfully run OMH Maps Sample App. :partying_face: