Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70435

Geolocation plugin not working

$
0
0

I’m scratching my head since last three days, but continuously failing to achieve my desired results, all I want is to fetch the geolocation coordinates, if the device location is turned off, a prompt is show to enable the location without leaving the app, and device location gets turn on I’ve verified it manually.
But the problem is everytime I try, I get fall into the error method

import { LocationAccuracy } from '@ionic-native/location-accuracy/ngx';
import { Plugins } from '@capacitor/core';
const { Geolocation } = Plugins;

this.locationAccuracy.request(this.locationAccuracy.REQUEST_PRIORITY_HIGH_ACCURACY).
then(() => {

      Geolocation.getCurrentPosition({ enableHighAccuracy: true }).then(loc => {

        alert('Position detected successfully' + loc);

      }).catch(error => {

        alert(error);

      });

    }).catch(deny => {

      alert('You denied the location');

    });

But there is something very strange, and that is just before launching the app, If I run google maps and locate my self, then my app works without any issue, otherwise it keep falling into error method.
Any help will be highly appreciated .

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 70435

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>