我想获取设备的当前位置,并将其获取到我们办公室内。但是当我按下“签到”按钮时,它总是会提示一条消息
findCoordinates = () => {
navigator.geolocation.getCurrentPosition(
position => {
// const location = JSON.stringify(position);
console.log("LOCATION", position.coords.longitude, position.coords.latitude);
this.setState({
latitude: position.coords.latitude,
longitude: position.coords.longitude,
});
this.props.onCheckin(this.state.latitude, this.state.longitude, this.props.employee_id);
},
error => Alert.alert(error.message),
// { enableHighAccuracy: true, timeout: 20000, maximumAge: 1000 }
{ enableHighAccuracy: true, timeout: 5000, maximumAge: 10000 }
);
};
答案 0 :(得分:0)
这是特定版本的android的问题,可以通过删除enableHighAccuracy: true