美文网首页React Native开发RNRN
React Native 高德地图定位模块 react-nati

React Native 高德地图定位模块 react-nati

作者: 7c00 | 来源:发表于2018-05-04 00:26 被阅读189次

作为 react-native-amap3d 的补充,提供独立的定位模块,支持逆地理编码。

image

用法

  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()

接口文档

相关文章

网友评论

  • e58d77f92926:大佬,iOS使用pod导入依赖,正常run是没问题的,但是Archive打包的时候link报错,依赖重复,好像是rn的依赖跟pods里的重复了,但是我删掉Linked Frameworks and Libraries下的提示重复的.a文件,app运行起来就闪退,不能删,又重复,有解决办法么?
  • haisonLIN:你好,安装了这个包报错了,请问怎样处理
    E:\LianjiangProject\GongJiang\android\app\src\main\java\com\gongjiang\MainApplication.java:6: 错误: 程序包cn.qiuxiang.react.geolocation不存在
    import cn.qiuxiang.react.geolocation.AMapGeolocationPackage;
    ^
    E:\LianjiangProject\GongJiang\android\app\src\main\java\com\gongjiang\MainApplication.java:28: 错误: 找不到符号
    new AMapGeolocationPackage(),
    ^
    符号: 类 AMapGeolocationPackage
    2 个错误
    :app:compileDebugJavaWithJavac FAILED

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':app:compileDebugJavaWithJavac'.
    > Compilation failed; see the compiler error output for details.

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

    BUILD FAILED

    Total time: 31.141 secs
    Could not install the app on the device, read the error above for details.
    Make sure you have an Android emulator running or a device connected and have
    set up your Android development environment:
    https://facebook.github.io/react-native/docs/getting-started.html
  • 慧丫丫:Analyzing dependencies
    Fetching podspec for `React` from `../node_modules/react-native`
    Fetching podspec for `react-native-amap-geolocation` from `../node_modules/react-native-amap-geolocation/lib/ios`
    Fetching podspec for `yoga` from `../node_modules/react-native/ReactCommon/yoga`
    Downloading dependencies
    Installing AMapFoundation (1.5.3)
    Installing AMapLocation (2.6.0)
    Using DoubleConversion (1.1.5)
    Using Folly (2016.10.31.00)
    Installing React 0.56.0
    Using boost-for-react-native (1.63.0)
    Using glog (0.3.4)
    Installing react-native-amap-geolocation (0.3.1)
    Using yoga (0.56.0.React)
    [!] The 'Pods-ddh' target has transitive dependencies that include static binaries: (/Users/sea/Desktop/ddh/ios/Pods/AMapLocation/AMapLocationKit.framework)

    [!] 'AMapFoundation' uses the unencrypted http protocol to transfer the Pod. Please be sure you're in a safe network with only trusted hosts in there. Please reach out to the library author to notify them of this security issue.

    [!] 'AMapLocation' uses the unencrypted http protocol to transfer the Pod. Please be sure you're in a safe network with only trusted hosts in there. Please reach out to the library author to notify them of this security issue.
    红色感叹号,如何处理
  • Coo啊:xcode 无法打包安装
    ld: warning: directory not found for option '-L/Users/jiangsong/Library/Developer/Xcode/DerivedData/playball-bjlyweameocqvxgmyadwanlslgdb/Build/Products/Debug-iphonesimulator/DoubleConversion'
    ld: warning: directory not found for option '-L/Users/jiangsong/Library/Developer/Xcode/DerivedData/playball-bjlyweameocqvxgmyadwanlslgdb/Build/Products/Debug-iphonesimulator/Folly'
    ld: warning: directory not found for option '-L/Users/jiangsong/Library/Developer/Xcode/DerivedData/playball-bjlyweameocqvxgmyadwanlslgdb/Build/Products/Debug-iphonesimulator/React'
    ld: warning: directory not found for option '-L/Users/jiangsong/Library/Developer/Xcode/DerivedData/playball-bjlyweameocqvxgmyadwanlslgdb/Build/Products/Debug-iphonesimulator/glog'
    ld: warning: directory not found for option '-L/Users/jiangsong/Library/Developer/Xcode/DerivedData/playball-bjlyweameocqvxgmyadwanlslgdb/Build/Products/Debug-iphonesimulator/react-native-amap-geolocation'
    ld: warning: directory not found for option '-L/Users/jiangsong/Library/Developer/Xcode/DerivedData/playball-bjlyweameocqvxgmyadwanlslgdb/Build/Products/Debug-iphonesimulator/yoga'
    ld: library not found for -lDoubleConversion
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

本文标题:React Native 高德地图定位模块 react-nati

本文链接:https://www.haomeiwen.com/subject/anjrrftx.html