Capacitor 2.2.0 Geolocation plugin problem

I’m absolutely exhausted by trying to get the location of user using Geolocation plugin.
But the problem is that if the GPS is already connected before launching my app, it works, otherwise it never works.
Meaning that If turn on the location on device after launching my app, Geolocation plugin never works.
here is the code I’m trying

if (Capacitor.isPluginAvailable('Geolocation')) {

      Plugins.Geolocation.getCurrentPosition().then(location => {


          animated: true,

          header: `Platform: ${Capacitor.getPlatform()}`,

          subHeader: 'Coordinates: ',

          message: `Latitude: ${location.coords.latitude}\n Longitude: ${location.coords.longitude}`

        }).then(alertEl => alertEl.present());

      }).catch(error => {

        console.log('Error:', error);


          animated: true,

          header: `Error Occured`,

          // subHeader: error,

          message: error.message

        }).then(alertEl => alertEl.present());



This is the simplest method and doing nothing anything rocket science.
How can I make my app to fetch the user location if the device GPS was disabled and user just enabled after launching my app.

Did you find the solution?

yes, used a plugin to show a pop in the beginning of app to turn on GPS, so I can fetch location without any problem