[Interest] Android: Better way of asserting permanent permission refusal

Pierre-Yves Siret py.siret at gmail.com
Tue Jun 26 15:05:01 CEST 2018


2018-06-26 13:27 GMT+02:00 René Hansen <renehh at gmail.com>:

> Hi,
>
>
> When requesting specific permissions through QtAndroid::requestPermissions{,Sync},
> the host native permissions popup has the option to "Don't show this
> again", on subsequent requests, which will permanently disable the popups
> on future invocations.
>
> From then on a permission can only be given through host sytem global
> settings.
>
> The question then becomes, is there a canonical way to figure out, if the
> user has ticked the "Don't show again" for a specific permission?
>
> Right now I've resorted to heuristic, where I time the response of the
> permissions request. Typically it comes back in < 150 msec, when it has
> been perma-denied, and the fastest I've been able to allow or deny it via
> the popup was about 900 msec. I've placed my guesstimate predicate at 400
> msec, to allow a bit of margin for error on slower devices.
>
> But... this seems like such a bad hack.
>
> Can anyone tell me of a better way to do this?
>
>
> Best regards,
>
> René Hansen
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
> Hello,

The better way is not do it.
This Qt API just mirrors the Android API, and there is no native way to
know if the user selected "Don't show this again" previously. At least not
without calling requestPermissions.

Why do you want to check this?
If you want to show a rationale to thw user about why the app need a
permission, you can use QtAndroid::shouldShowRequestPermissionRationale.
It will return true if the user previously denied the permission without
selecting the "Don't show this again" option.

Regards,
Pierre-Yves Siret
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180626/759e35c2/attachment.html>


More information about the Interest mailing list