简体   繁体   中英

Location permission doesn't switch on the service ionic cordova

In my Ionic 1 app I implemented Geolocation service by following https://www.joshmorony.com/integrating-google-maps-with-an-ionic-application/ tutorial using cordova-plugin-geolocation

As the documentation says after the installing my AndroidManifest.xml file includes both of the following lines for the permission request

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

When I test the app on my mobile it asks for the permission. But when I Allow it, it doesn't switch on location service on my mobile. I have to manually switch on it. Why is that ? What is that I'm missing ?

EDIT : When I switch on the service manually I can see the map and I'm getting the exact location. But Allowing the permission request doesn't switch on the service on my phone

Asking for a permission does not necessarily imply that the feature/service will be enabled automatically. If the permission is granted, the application is able to use the protected features. Protected features may or may not be enabled.

You need to check to see if the location service is enabled, if not send the user to device's setting to enable the location service.

Here is an android example, you have to do something similar with your ionic app

How to prompt user to enable GPS_PROVIDER and/or NETWORK_PROVIDER?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM