Issue
I'm coding an app using Ionic & Capacitor that requires GPS. I want to know if there is a way to invoke this dialogue and enable GPS
using capacitor.
Solution
In Capacitor 3 all plugins that require permission have methods for requesting permissions and checking status of permissions.
So, in @capacitor/geolocation
plugin you can call Geolocation.requestPermissions();
for both iOS and Android.
Old answer for Capacitor 2 and older:
You can use Geolocation plugin itself to request it's permissions like this: Capacitor.Plugins.Geolocation.requestPermissions();
on Android. But it's not possible on iOS.
Anyway, it's always recommended to let the plugins work themselves, when you try to use getCurrentPosition
or watchPosition
, the plugin will automatically request the permission if not granted.
Answered By - jcesarmobile
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.