googlesamples / easypermissions

Simplify Android M system permissions
https://firebaseopensource.com/projects/googlesamples/easypermissions/
Apache License 2.0
9.86k stars 1.46k forks source link

API recommended #310

Closed Dongjian413 closed 4 years ago

Dongjian413 commented 4 years ago

API is too limited, it has to pass activity or Fragment. Currently, it is impossible to request permissions in any View. In fact, I think permissions should not be associated with the interface, just a separate functional API

samtstern commented 4 years ago

@Dongjian413 EasyPermissions is an opinionated API on top of the base Android permissions API. We believe that permissions should only be requested while the app is in the foreground, which is why we request an Activity or a Fragment.

The base system API only needs a Context so if you want to request permissions in other flows you can use that: https://developer.android.com/training/permissions/requesting