Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin: Runtime permissions checks for Android and iOS #685

Closed
sethladd opened this issue Dec 2, 2015 · 13 comments
Closed

Plugin: Runtime permissions checks for Android and iOS #685

sethladd opened this issue Dec 2, 2015 · 13 comments
Assignees
Labels
c: new feature Nothing broken; request for a new capability framework flutter/packages/flutter repository. See also f: labels. package flutter/packages repository. See also p: labels.

Comments

@sethladd
Copy link
Contributor

sethladd commented Dec 2, 2015

Android M, and iOS, both have a concept of runtime permissions. A customer asked if this was possible to use inside of Flutter.

@sethladd sethladd added the framework flutter/packages/flutter repository. See also f: labels. label Dec 2, 2015
@Hixie Hixie added c: new feature Nothing broken; request for a new capability affects: services labels Dec 2, 2015
@Hixie Hixie modified the milestone: Blue Sky Dec 16, 2015
@abarth abarth modified the milestones: 5: Make Hixie proud, 4: Make shippers happy Jan 26, 2017
@mit-mit
Copy link
Member

mit-mit commented Feb 2, 2017

@sethladd @abarth is there any work here? As far as I understand it, this is transparent to the app. You simply request permissions in the manifest and code, and the OS takes it from there?

https://developer.android.com/training/permissions/requesting.html#perm-check

@sethladd
Copy link
Contributor Author

sethladd commented Feb 2, 2017

Would the UI ever need to determine if a permission has been granted yet (or not) ? For example, would I want to show UI screen A or B if a permission has been granted ?

@mit-mit
Copy link
Member

mit-mit commented Feb 3, 2017

Yes, good catch. The UI is actually expected to do that (as the user may decline the permission, and the app is expected to deal with that), e.g.:

// Assume thisActivity is the current activity
int permissionCheck = ContextCompat.checkSelfPermission(thisActivity,
        Manifest.permission.WRITE_CALENDAR);

@mit-mit mit-mit changed the title Support for runtime permissions for Android and iOS Plugin: Runtime permissions checks for Android and iOS Feb 3, 2017
@mit-mit mit-mit modified the milestones: 3: Make conferences happy, 4: Make shippers happy Mar 21, 2017
@Hixie Hixie added the plugin label May 23, 2017
@mit-mit
Copy link
Member

mit-mit commented May 29, 2017

From discussion today this is a documentation gap, not a framework gap. We should document that if a plugin needs a certain permission x, then best practice is to offer hasPermissionX method in the Dart API of the plugin.

@mit-mit mit-mit self-assigned this May 29, 2017
@eseidelGoogle
Copy link
Contributor

My understanding from @lukef was the permission dance on iOS and Android were a non-trivial amount of code. So much so he was considering writing a flutter plugin to help with such?

@mit-mit
Copy link
Member

mit-mit commented May 31, 2017

I'm not sure I understand. The there are many different checks, so the actual checks would need to be placed where the native code under those checks is located. @lukef can you elaborate?

@Hixie
Copy link
Contributor

Hixie commented Jun 20, 2017

It's not clear what is being requested here. @mit-mit If there's something we should document, can you file a bug specifically saying what should be documented? Thanks!

@Hixie Hixie closed this as completed Jun 20, 2017
@lukef
Copy link
Contributor

lukef commented Jun 20, 2017

We have an early stage plugin here: https://github.com/goposse/permit.

It is NOT ready for any kind of integration into an app of any kind, but it will support common permission on iOS and Android. We decouple the permissions from the feature as it is generally impossible to integrate the two and have acceptable UX.

I'll let you know when it is refactored and ready for review.

@nevi-me
Copy link

nevi-me commented Mar 16, 2018

The goposse/permit library is no longer maintained. Other than forking it (I'm a beginner with Dart, won't know what I'm doing), what alternatives are there?

@lukef
Copy link
Contributor

lukef commented Mar 16, 2018

You can look at the permit code as a good starting point however, you should definitely invest in an understanding of how the permissions work on iOS and Android as they are system level requirements and they can change from time to time.

Some plugins will implement permissions directly as well so you could check to see if there is a plugin that you can use that will provide that feature also.

@nevi-me
Copy link

nevi-me commented Mar 17, 2018

Thanks @lukef, I'll invest time in understanding permissions, I'm concerned with Android for now, so I'll spend time there first

@lukef
Copy link
Contributor

lukef commented Mar 17, 2018

Feel free to leave a question on stack overflow as well. That way I (or someone else) can answer and other people who might get stuck can benefit!

@github-actions
Copy link

github-actions bot commented Sep 3, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 3, 2021
@flutter-triage-bot flutter-triage-bot bot added the package flutter/packages repository. See also p: labels. label Jul 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: new feature Nothing broken; request for a new capability framework flutter/packages/flutter repository. See also f: labels. package flutter/packages repository. See also p: labels.
Projects
None yet
Development

No branches or pull requests

7 participants