You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PermissionsDispatcher provides simple annotation-based API to handle runtime permissions in Marshmallow.
8
7
9
8
[Runtime permissions](https://developer.android.com/preview/features/runtime-permissions.html) is so great for users but also the hell for developers.
10
9
11
-
You can be released from the burden that writing a bunch of check statements whether a permission have been granted or not.
10
+
You can be released from the burden that writing a bunch of check statements whether a permission have been granted or not.
12
11
13
12
## Usage
14
13
@@ -18,11 +17,17 @@ Here's a minimum example that you register `MainActivity` which requires `Manife
18
17
19
18
There are only few annotations.
20
19
20
+
#### Must
21
+
21
22
-`@RuntimePermissions`: Register an Activity or Fragment to handle permissions.
22
23
-`@NeedsPermission`: Register a method which the permission is needed.
23
24
- You can use `@NeedsPermissions` for multiple requests.
25
+
26
+
#### Option
24
27
-`@ShowsRationale`: Register a method which explains why the permission is needed. An annotated method is called when `shouldShowRequestPermissionRationale` returns true.
25
28
- You can use `@ShowsRationales` for multiple requests.
29
+
-`@DeniedPermission`: Register a method called when user deny a permission.
30
+
- You can use `@DeniedPermissions` for multiple requests.
26
31
27
32
> NOTE: Annotated methods must be package private or above.
28
33
@@ -38,11 +43,16 @@ public class MainActivity extends Activity {
0 commit comments