/react-native-amap-geolocation

React Native geolocation module for Android + iOS

Primary LanguageJavaMIT LicenseMIT

react-native-amap-geolocation npm version build status

React Native 高德地图定位模块,支持 Android + iOS。

使用

  1. 安装
  2. 获取 Key:
import { Geolocation } from "react-native-amap-geolocation"

await Geolocation.init({
  ios: "9bd6c82e77583020a73ef1af59d0c759",
  android: "043b24fe18785f33c491705ffe5b6935"
})

Geolocation.setOptions({
  interval: 8000,
  distanceFilter: 20
})

Geolocation.addLocationListener(location => console.log(location))
Geolocation.start()

文档

示例

你可以直接下载安装 example.apk,或者按照以下步骤运行项目示例:

yarn

# android
yarn run-android

# ios
cd ios && pod install && cd ..
yarn run-ios