You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "jcesarmobile (JIRA)" <ji...@apache.org> on 2016/12/01 08:38:58 UTC

[jira] [Closed] (CB-12201) Possibility to check if Geolocation Permissions have been granted before

     [ https://issues.apache.org/jira/browse/CB-12201?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

jcesarmobile closed CB-12201.
-----------------------------
    Resolution: Won't Fix
      Assignee: jcesarmobile

Yes, cordova-diagnostic-plugin is the way to go.
This plugin follows the W3C geolocation API and there is no such method to check the permissions, so we shouldn't add it.

> Possibility to check if Geolocation Permissions have been granted before
> ------------------------------------------------------------------------
>
>                 Key: CB-12201
>                 URL: https://issues.apache.org/jira/browse/CB-12201
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: Plugin Geolocation
>            Reporter: Simon
>            Assignee: jcesarmobile
>
> As soon as e.g. getCurrentLocation() is called, the OS asks for geolocation permission. This is great.
> But sometimes you want to see if the user has granted these permissions, without possibly trigger the native permission popup.
> there is the `navigator.permissions` api, but not available for iOS.
> POSSIBLE USE CASES:
> - You have a button "enable geolocation" in your app. Sure, you store somewhere, as soon as the user has granted the permissions once. But the permissions can be revoked, that the app doesn't know about and then would be out of sync.
> - The user starts the app and you want to track the users location, where the app has been opened. If you wouldn't have a check, the user will get asked right away for geolocation permissions, which is very bad UX.
> IMAGINABLE USAGE:
> navigator.geolocation.hasPermission(result => {
>     if (result.isGranted) {
>         // proceed with e.g. navigator.geolocation.getCurrentPosition() without triggering the native permission popup
>     }
> });
> or there might be even an easy workaround that doesn't require any alteration - but would be great to have this out of the box.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org