How to check if Geolocation is enable or not with native GPS?

Hi there,

I use google maps and geolocation to know my location and displays it on the map.
If my native location option is disable, the map isn’t displayed… Is there a way to check if the option is activated and then for example ask the user with a Confirmation Alerts : < “Do you want to activate your location” Yes - No >

Thanks in advance for your time and answers ! :smile:

Enjoy Coding !

1 Like

Check if device location mode is enabled for GPS:

Prompt the user to enable GPS automatically (without leaving the app):


Thank you very much !
That was quick, I’ll let you know the result :wink:

1 Like

Be careful they don’t say in Github that you have to install diagnostic also in ionic-native:

 npm install --save @ionic-native/diagnostic

use it as

import { Diagnostic } from '@ionic-native/diagnostic';

And the same for the location accuracy:

npm install --save @ionic-native/location-accuracy

use it as

import { LocationAccuracy } from '@ionic-native/location-accuracy';

can find this on documentation by this link

Hope it helps :slight_smile:


hey, can you share the code? :slight_smile:

sir i tried but i got
[Warning] Ionic Native: tried calling Diagnostic.isGpsLocationEnabled, but the Diagnostic in the console,i have properly installed the plugin but in android working?