React native 位置错误';Google play服务不可用';,自然反应
在我的应用程序中,我使用React native 位置错误';Google play服务不可用';,自然反应,react-native,location,android-gps,React Native,Location,Android Gps,在我的应用程序中,我使用react native geolocation service获取位置更新。 对于IOS应用程序,它工作得很好,但是对于android应用程序,它给了我这个错误 我已经启用了权限和所有,这是观察者 this.watchId = Geolocation.watchPosition( position => { // this.setState({ location: position }); // console.lo
react native geolocation service
获取位置更新。
对于IOS应用程序,它工作得很好,但是对于android应用程序,它给了我这个错误
我已经启用了权限和所有,这是观察者
this.watchId = Geolocation.watchPosition(
position => {
// this.setState({ location: position });
// console.log(position);
console.log('got position ')
console.log(position)
this.dispatch({
type: UPDATE_LOCATION,
location: position
})
},
error => {
// this.setState({ location: error });
console.log('error occured')
console.log(JSON.stringify(error))
console.log(error);
},
{
enableHighAccuracy: true,
distanceFilter: 0,
interval: 10000,
fastestInterval: 5000
}
);
无论我是在模拟器中运行应用程序,还是android设备错误都保持不变。
在选项参数createtrialum中,ios的代码运行良好。检查移动平台,如果安卓-空括号,否则-接收您需要的对象。大概是这样的:
Platform.OS==='android'?{}:{enableHighAccurance:true,超时:20000,最大值:10000}