This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.

Expo Maps iconExpo Maps

A library that provides access to Google Maps on Android and Apple Maps on iOS.

Android
iOS
Recommended version:
~56.0.7

Installation

Terminal
- npx expo install expo-maps
- yarn expo install expo-maps
- pnpm expo install expo-maps
- bun expo install expo-maps

If you are installing this in an existing React Native app, make sure to install expo in your project.


Watch: Expo Maps Deep Dive
Watch: Expo Maps Deep Dive

Add Google Maps and Apple Maps to your Expo app with the expo-maps library.

Configuration

Expo Maps provides access to the platform native map APIs on Android and iOS.

  • Apple Maps (available on
    iOS
    only)
    . No additional configuration is required to use it after installing this package.
  • Google Maps (available on
    Android
    only)
    . While Google provides a Google Maps SDK for iOS, Expo Maps supports it exclusively on Android. If you want to use Google Maps on iOS, you can look into using an alternative library or writing your own.

Google Cloud API setup

Before you can use Google Maps on Android, you need to register a Google Cloud API project, enable the Maps SDK for Android, and add the associated configuration to your Expo project.

Set up Google Maps on Android

1

Register a Google Cloud API project and enable the Maps SDK for Android

  • Open your browser to the Google API Manager and create a project.
  • Once it's created, go to the project and enable the Maps SDK for Android.

2

Copy your app's SHA-1 certificate fingerprint

  • If you are deploying your app to the Google Play Store, you'll need to upload your app binary to Google Play console at least once. This is required for Google to generate your app signing credentials.
  • Go to the Google Play Console > (your app) > Release > Setup > App integrity > App Signing.
  • Copy the value of SHA-1 certificate fingerprint.

3

Create an API key

  • Go to Google Cloud Credential manager and click Create Credentials, then API Key.
  • In the modal, click Edit API key.
  • Under Key restrictions > Application restrictions, choose Android apps.
  • Under Restrict usage to your Android apps, click Add an item.
  • Add your android.package from app.json (for example: com.company.myapp) to the package name field.
  • Then, add the SHA-1 certificate fingerprint's value from step 2.
  • Click Done and then click Save.

4

Add the API key to your project

  • Copy your API Key into your app.json under the android.config.googleMaps.apiKey field.
  • Create a new development build, and you can now use the Google Maps API on Android with expo-maps.

Permissions

To display the user's location on the map, you need to declare and request location permission beforehand. You can configure this using its built-in config plugin if you use config plugins in your project (Continuous Native Generation (CNG)). The plugin allows you to configure various properties that cannot be set at runtime and require building a new app binary to take effect. If your app does not use CNG, then you'll need to manually configure the library.

Example app.json with config plugin

app.json
{ "expo": { "plugins": [ [ "expo-maps", { "requestLocationPermission": true, "locationPermission": "Allow $(PRODUCT_NAME) to use your location" } ] ] } }

Configurable properties

NameDefaultDescription
requestLocationPermissionfalse

A boolean to add permissions to AndroidManifest.xml and Info.plist.

locationPermission"Allow $(PRODUCT_NAME) to use your location"
Only for: 
iOS

A string to set the NSLocationWhenInUseUsageDescription permission message.

Usage

import { AppleMaps, GoogleMaps } from 'expo-maps'; import { Platform, Text } from 'react-native'; export default function App() { if (Platform.OS === 'ios') { return <AppleMaps.View style={{ flex: 1 }} />; } else if (Platform.OS === 'android') { return <GoogleMaps.View style={{ flex: 1 }} />; } else { return <Text>Maps are only available on Android and iOS</Text>; } }

Custom marker icons

You can use the useImage hook from expo-image to load custom marker and annotation icons.

The following example shows how to display a custom marker icon with Google Maps on Android.

import { useImage } from 'expo-image'; import { GoogleMaps } from 'expo-maps'; export default function Map() { const icon = useImage('https://example.com/marker.svg', { maxWidth: 48, maxHeight: 48 }); return ( <GoogleMaps.View style={{ flex: 1 }} markers={[ { coordinates: { latitude: 37.78825, longitude: -122.4324 }, icon: icon ?? undefined, anchor: { x: 0.5, y: 0.5 }, }, ]} /> ); }

GoogleMaps.Marker.icon expects an image reference, such as the value returned by the useImage hook from the expo-image package. It does not accept an image source directly.

The loaded image dimensions determine the marker size, not a marker style prop. For SVG icons, set width, height, and viewBox in the SVG, or pass maxWidth and maxHeight to the useImage hook. You can use anchor to align custom icons with their coordinates.

API

import { AppleMaps, GoogleMaps } from 'expo-maps'; // AppleMaps.View and GoogleMaps.View are the React components

No API data file found, sorry!

Permissions

Android

To show the user's location on the map, the expo-maps library requires the following permissions:

  • ACCESS_COARSE_LOCATION: for approximate device location
  • ACCESS_FINE_LOCATION: for precise device location
Android permissionDescription

ACCESS_COARSE_LOCATION

Allows an app to access approximate location.

ACCESS_FINE_LOCATION

Allows an app to access precise location.

FOREGROUND_SERVICE

Allows a regular application to use Service.startForeground.

FOREGROUND_SERVICE_LOCATION

Allows a regular application to use Service.startForeground with the type "location".

ACCESS_BACKGROUND_LOCATION

Allows an app to access location in the background.

iOS

The following usage description keys are used by this library:

Info.plist keyDescription

NSLocationWhenInUseUsageDescription

A message that tells the user why the app is requesting access to the user’s location information while the app is running in the foreground.