[英]Android Emulator React Native Geolocation not working
[英]Geolocation not working in React native project
我使用 expo 创建一个项目:
expo init geotest
接下来安装lib:
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')]
所有的想法都结束了,请帮忙。
我认为您应该使用expo-location
并正确阅读文档。 这是链接https://docs.expo.io/versions/latest/sdk/location/ 。 如果您在执行此操作时遇到任何问题。 然后随时问我。 谢谢你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.