Different Location Accuracy Result on Google Map App and Nat

Posted by osahonoduware on 29-Dec-2017 16:20

I utilized the NativeScript Geolocator plugin with an Accuracy.high option (see code below) to obtain the longitude & latitude of my location on an Android device (version 7.0). The horizontal/vertical accuracy of the location returned was a range of 500 - 1,500 metres:

// Import Section

import { Component, ElementRef, OnInit, ViewChild } from "@angular/core";

import { View } from "ui/core/view";

import * as geolocation from "nativescript-geolocation";

import * as camera from "nativescript-camera";

import { Image } from "ui/image";

import { Accuracy } from "ui/enums";

// Function to get the current location

buttonGetLocationTap() {

   geolocation.isEnabled().then(function (isEnabled) {

       if (!isEnabled) {

           geolocation.enableLocationRequest().then(function () {}, function (e) {

               console.log("Error: " + (e.message || e));

           });

       }

   }, function (e) {

       console.log("Error: " + (e.message || e));

   });

   if(geolocation.isEnabled()) {

     var location = geolocation.getCurrentLocation({desiredAccuracy: Accuracy.high, updateTime: 5000, timeout: 20000}).

     then(function(loc) {

         if (loc) {

             console.log("Current location is: Longitude => " + loc.longitude + "; Latitude => " + loc.latitude +

                         "; Hor.Accuracy: "+loc.horizontalAccuracy+"; Ver.Accuracy: "+loc.verticalAccuracy);

         }

     }, function(e){

         console.log("Error: " + e.message);

     });

   }    

 }

When I put the location obtained on Google Map (using the required Latitude,Longitude pair), the location is very far from my actual location (corresponding to the horizontal/vertical accuracy).

However, when I use the Google Map mobile app on the same device to obtain my current location it is very accurate (as displayed by the blue marker/indicator).

I would have thought that the accuracy of the location provided by the NativeScript Geolocator plugin (using the Accuracy.high option) should be about the same as that of Google Map mobile app on the same device since they use the same Google Play Services.

Could someone help with this.

All Replies

Posted by egarcia on 02-Jan-2018 07:42

Hello,

This forum focuses on the Mobile support with OpenEdge.

NativeScript specific questions are better posted on NativeScript specific forums.

I see that you have received a reply via the Telerik forum and the NativeScript discourse forum:

- www.telerik.com/.../different-location-accuracy-result-on-google-map-and-nativescript-geolocator-on-same-mobile-device

- discourse.nativescript.org/.../3755

Please let us know if you would need additional information from this forum.

Thank you and regards.

This thread is closed