navigator.geolocation.getCurrentPosition无法正常工作

本杰明·巴金斯(Benjamin Baggins)

我似乎navigator.geolocation无法上班。它进入错误代码为3的错误功能,错误消息为“位置请求超时”,下面的代码在做什么?

import { AppRegistry } from 'react-native'
import { App } from './src'

var options = {
    enableHighAccuracy: true,
    timeout: 5000,
    maximumAge: 0
  };

  function success(pos) {
    var crd = pos.coords;

    console.log('Your current position is:');
    console.log(`Latitude : ${crd.latitude}`);
    console.log(`Longitude: ${crd.longitude}`);
    console.log(`More or less ${crd.accuracy} meters.`);
  }

  function error(err) {
    console.warn(`ERROR(${err.code}): ${err.message}`);
  }

  navigator.geolocation.getCurrentPosition(success, error, options);

GLOBAL.XMLHttpRequest = GLOBAL.originalXMLHttpRequest || GLOBAL.XMLHttpRequest
console.error = (error) => error.apply
AppRegistry.registerComponent('vepo', () => App)
斯法蒂尼

这是React本机(特别是Android)中的已知位置错误。不要发送第三个参数(选项一个),看看是否可行。

如果与highAccuracy和maximumAge有关

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

navigator.geolocation.getCurrentPosition()永远不会在Android的WebView中返回

iOS中的Cordova geoLocation插件无法正常工作

Chrome navigator.geolocation.getCurrentPosition()错误403

在Ionic中使用navigator.geolocation或$ cordovaGeolocation

navigator.geolocation.getCurrentPosition / watchPosition在android 6.0中不起作用

没有GPS且无法通过navigator.geolocation在本机上获取当前位置

将多个侦听器添加到navigator.geolocation.getCurrentPosition

cordova中的navigator.geolocation.getCurrentPosition仅提供10米的精度

Flutter Navigator无法正常工作

geolocation.getCurrentPosition问题

如何在打字稿中的navigator.geolocation.getCurrentPosition的成功回调函数中传递额外的参数?

navigator.geolocation.getCurrentPosition在React Native中不起作用

navigator.geolocation.getCurrentPosition()未从googleapi获得响应

Navigator.geoLocation.getCurrentPosition无法正常工作的问题

TypeError:undefined不是在react-native-google-places-autocomplete中的对象(评估“ navigator.geolocation.getCurrentPosition”)

在Android Webview的navigator.geolocation.getCurrentPosition()中获取“位置信息不可用”错误

是否可以调用“ navigator.geolocation.getCurrentPosition(初始化,失败);” 只有一次

navigator.geolocation.getCurrentPosition没有为iPhone5超时

使用DistanceMatrixService和navigator.geolocation.getCurrentPosition来获取时间和距离

React-Native Geolocation在Android上无法正常工作

Javascript Navigator.geolocation

Cordova navigator.geolocation.getCurrentPosition中的错误(代码:2)

navigator.geolocation.getCurrentPosition 不适用于 onClick

在 React Native 中使用 navigator.geolocation.getCurrentPosition 显示精度的单元是哪个?

为什么在 navigator.geolocation.getCurrentPosition() 为对象赋值并返回后,我无法访问对象中的值?

如何强制 navigator.geolocation.getCurrentPosition 失败

React Native navigator.geolocation 未定义

来自 dart:html 的 Geolocation.getCurrentPosition 在启用 NNBD 的情况下无法在发布模式下工作

navigator.geolocation.watchPosition 空位