Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/227.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 你能得到准确的位置吗_Android_React Native_Geolocation_Positioning - Fatal编程技术网

Android 你能得到准确的位置吗

Android 你能得到准确的位置吗,android,react-native,geolocation,positioning,Android,React Native,Geolocation,Positioning,最近,我使用react native开发了一个定位模块,试图通过。但问题是,我不能得到准确的位置与GPS上 演示: 该方法的精度范围为10米至200米,不符合要求。 我想知道是否有任何建议来提高这种方法的准确性?或者有没有其他方法可以在react native中获得准确的位置 let Timer; export default class XXX extends Component { componentDidMount() { timer = setInterval(t

最近,我使用react native开发了一个定位模块,试图通过。但问题是,我不能得到准确的位置与GPS上

演示:

该方法的精度范围为10米至200米,不符合要求。 我想知道是否有任何建议来提高这种方法的准确性?或者有没有其他方法可以在react native中获得准确的位置

let Timer;
export default class XXX extends Component {
    componentDidMount() {
        timer = setInterval(this.getLocation,8000);
    }
    getLocation() {
        Geolocation.getCurrentPosition(
            location => {
                let result = "longitude :" + location.coords.longitude +
                    "\nlatitude:" + location.coords.latitude;
                alert(result);
            },
            error => {
                alert("failed to positioning:"+ error);
            }
        );
    }
    onBackAndroid = () => {
        if (this.lastBackPressed && this.lastBackPressed + 2000 >= Date.now()) {
        return false;
    }
        clearInterval(timer);
        return true;
    };
}