【问题标题】:Geolocation not working in React native project地理位置在 React 本机项目中不起作用
【发布时间】:2020-02-25 14:20:10
【问题描述】:

我使用 expo 创建了一个项目:

expo init geotest

接下来安装库:

npm install react-native-geolocation-service

在 app.json 中添加权限:

"android": {
    "permissions": [
        "ACCESS_FINE_LOCATION"
    ]
}

App.js 包含以下代码:

https://github.com/Agontuk/react-native-geolocation-service/blob/master/example/App.js

但是当我调用 Geolocation.getCurrentPosition 时,我收到警告:

[Unhandled promise rejection: TypeError: null is not an object (evaluating 'RNFusedLocation.getCurrentPosition')]

所有想法都结束了,请帮忙。

【问题讨论】:

    标签: javascript android react-native geolocation frontend


    【解决方案1】:

    我认为您应该使用expo-location 并正确阅读文档。这是链接https://docs.expo.io/versions/latest/sdk/location/。如果您在实施此操作时遇到任何问题。然后随时问我。谢谢。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-27
      • 1970-01-01
      相关资源
      最近更新 更多