cordova-plugin-geolocation icon indicating copy to clipboard operation
cordova-plugin-geolocation copied to clipboard

Do not work if the location previously was turn off and we turn on during the app usage

Open ahsan-alii opened this issue 5 years ago • 1 comments

Bug Report

Problem

Something very strange is happening to me, If I run my app (in which I'm using this plugin) directly it doesn't works, but just before launching my app, If I run google maps and locate my self, then run my app again it works without any issue, otherwise it keep falling into error method of getCurrentPosition method

Command or Code

   this.locationAccuracy.request(this.locationAccuracy.REQUEST_PRIORITY_HIGH_ACCURACY).then(() => {
        Geolocation.getCurrentPosition({ enableHighAccuracy: true }).then(loc => {
          alert('Position detected successfully' + loc.coords.accuracy);
        }).catch(err => {
          alert(err);
        });
      }).catch(deny => {
        alert('You denied the location');
      });

Environment, Platform, Device

Oneplus 3T

Version information

Checklist

  • [x] I searched for existing GitHub issues
  • [x] I updated all Cordova tooling to most recent version
  • [x] I included all the necessary information above

ahsan-alii avatar May 29 '20 19:05 ahsan-alii

Try

Geolocation.getCurrentPosition(
  { 
    enableHighAccuracy: true,
    maximumAge: 0 /* Force the plugin to request the positon  and not use cached positions */
  })

selmo47 avatar Oct 31 '21 09:10 selmo47

Closing as stale.

breautek avatar Jun 05 '23 02:06 breautek