Cordova Geolocation plugin returning empty position object on Android

后端 未结 3 705
感情败类
感情败类 2021-01-12 07:52

I\'ve had quite some issues with the Geolocation Cordova plugin (org.apache.cordova.geolocation). It works fine on iOS, but it doesn\'t at all on Android.

As I under

3条回答
  •  余生分开走
    2021-01-12 08:03

    The Geolocation object passed to the callbacks in navigator.geolocation.getCurrentLocation() contains two prototype getters coords and timestamp, which means that hasOwnProperty will return false, which I assume that JSON.stringify excludes.

    When logging all keys on the object I get the following:

    [object Geoposition]
      .coords [object Coordinates]
         .latitude
         .longitude
         .altitude
         .accuracy 
         .altitudeAccuracy
         .heading
         .speed
      .timestamp
    

    Never the less, these values are valid when accessed normally.

提交回复
热议问题