Skip to content

API Documentation

Complete API reference documentation.

⚠️ Permission and Privacy Compliance Warning

Before using map and location features, ensure:

  1. ✅ Required permissions are configured in native project
  2. ✅ Request user authorization at runtime
  3. ✅ Comply with privacy laws and regulations
  4. ✅ On a fresh install, complete privacy consent before initSDK
  5. ✅ After consent is granted once, privacy state is persisted and auto-restored natively

Table of Contents

Core Features

Extended Features

Module Layout

expo-gaode-map uses a monorepo layout:

  • Core package (expo-gaode-map) - map display, location, and overlays
  • Built-in search (expo-gaode-map / expo-gaode-map-navigation) - POI search and nearby search
  • Navigation package (expo-gaode-map-navigation) - route planning and real-time navigation; install it instead of the core package
  • Web API package (expo-gaode-map-web-api) - optional web service APIs

Install only the packages you need to keep the app smaller.

Navigation package note

The navigation package is an all-in-one solution with built-in map functionality. It cannot be installed together with the core package expo-gaode-map.

Quick Navigation

Map Component

tsx
import { MapView } from 'expo-gaode-map';

<MapView
  style={{ flex: 1 }}
  initialCameraPosition={{
    target: { latitude: 39.9, longitude: 116.4 },
    zoom: 10,
  }}
  myLocationEnabled={true}
/>

Location Features

tsx
import { ExpoGaodeMapModule } from 'expo-gaode-map';

// Complete privacy compliance first
if (!ExpoGaodeMapModule.getPrivacyStatus().isReady) {
  ExpoGaodeMapModule.setPrivacyConfig({
    hasShow: true,
    hasContainsPrivacy: true,
    hasAgree: true,
  });
}

// If native keys are configured via Config Plugin or manually, and you only use
// map/location features, you can skip initSDK.
// Only needed for Web API features:
ExpoGaodeMapModule.initSDK({ webKey: 'your-web-api-key' });

// Get current location
const location = await ExpoGaodeMapModule.getCurrentLocation();

Overlays

tsx
import { Circle, Marker, Polyline, Polygon } from 'expo-gaode-map';

<MapView>
  <Marker position={{ latitude: 39.9, longitude: 116.4 }} />
  <Circle center={{ latitude: 39.9, longitude: 116.4 }} radius={1000} />
</MapView>

Search Features

tsx
import { searchPOI, searchNearby, getInputTips } from 'expo-gaode-map';

// Keyword search
const result = await searchPOI({
  keyword: 'Starbucks',
  city: 'Beijing',
});

// Nearby search
const nearby = await searchNearby({
  center: { latitude: 39.9, longitude: 116.4 },
  keyword: 'restaurant',
  radius: 2000,
});

// Input tips
const tips = await getInputTips({
  keyword: 'Star',
  city: 'Beijing',
});