Location permission doesn't switch on the service ionic cordova

I’ve been developing an App and I’ve integrated cordova-plugin-geolocation plugin according to this https://www.joshmorony.com/integrating-google-maps-with-an-ionic-application/ tutorial.
The map is working fine when I run it on browser using ionic-serve.

But when I test it on my android phone it requests location permission. But when I allow it, it doesn’t switch on the location service on my phone. I have to manually enable it. Why is that ? What am I missing ?

I posted this on Stackoverflow. Link is mentioned below.