Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/19.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.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
React native 位置错误';Google play服务不可用';,自然反应_React Native_Location_Android Gps - Fatal编程技术网

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}