nabinbhandari / Android-Permissions

Library for easy handling of android run-time permissions.
409 stars 83 forks source link

Is it possible to call and get permission callbacks in Fragment? #15

Closed isabsent closed 5 years ago

isabsent commented 5 years ago

There is an opportunity to call permission request right from the Fragment:

void requestPermissions(@NonNull String[] permissions, int requestCode)

and get a result in the same Fragment:

onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults)

in android.support.v4.app.Fragment. Does your library allow this too?

nabinbhandari commented 5 years ago

You don't need to use onRequestPermissionsResult to get the result. You can simply pass the context using the method getContext() of Fragment and get the callback directly in the parameter of type PermissionHandler in the check method.