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 a simple annotation-based API to handle runtime permissions.
8
8
9
9
This library lifts the burden that comes with writing a bunch of check statements whether a permission has been granted or not from you, in order to keep your code clean and safe.
10
10
11
-
## Usage
12
-
13
-
- If you're using Kotlin check [**Kotlin ver**](https://github.com/hotchemi/PermissionsDispatcher/blob/master/doc/kotlin_support.md) first of all.
14
-
15
-
Here's a minimum example, in which you register a `MainActivity` which requires `Manifest.permission.CAMERA`.
PermissionsDispatcher introduces only a few annotations, keeping its general API concise:
26
-
27
-
> NOTE: Annotated methods must not be `private`.
28
-
29
-
|Annotation|Required|Description|
30
-
|---|---|---|
31
-
|`@RuntimePermissions`|**✓**|Register an `Activity` or `Fragment`(we support both) to handle permissions|
32
-
|`@NeedsPermission`|**✓**|Annotate a method which performs the action that requires one or more permissions|
33
-
|`@OnShowRationale`||Annotate a method which explains why the permission/s is/are needed. It passes in a `PermissionRequest` object which can be used to continue or abort the current permission request upon user input|
34
-
|`@OnPermissionDenied`||Annotate a method which is invoked if the user doesn't grant the permissions|
35
-
|`@OnNeverAskAgain`||Annotate a method which is invoked if the user chose to have the device "never ask again" about a permission|
Upon compilation, PermissionsDispatcher generates a class for `MainActivityPermissionsDispatcher`([Activity Name] + PermissionsDispatcher), which you can use to safely access these permission-protected methods.
73
-
74
-
The only step you have to do is delegating the work to this helper class:
- If you use [AndroidAnnotations](http://androidannotations.org/), you need to add [AndroidAnnotationsPermissionsDispatcherPlugin](https://github.com/AleksanderMielczarek/AndroidAnnotationsPermissionsDispatcherPlugin).
104
-
105
-
### Known issues
106
-
107
-
If you're in trouble check known issues [list](https://github.com/hotchemi/PermissionsDispatcher/blob/master/doc/known_issues.md) before filing an issue.
108
-
109
-
### Users
110
-
111
-
Thankfully we've got hundreds of [users](https://github.com/hotchemi/PermissionsDispatcher/blob/master/doc/users.md) around the world!
11
+
For more information please see [the website](https://permissions-dispatcher.github.io/).
112
12
113
13
## Download
114
14
115
-
NOTE: 4.x only supports [Jetpack](https://developer.android.com/jetpack/). If you use appcompat 3.x which is almost stable is the way to go.
15
+
NOTE: 4.x only supports [Jetpack](https://developer.android.com/jetpack/). If you still use appcompat 3.x is the way to go.
116
16
117
17
To add PermissionsDispatcher to your project, include the following in your **app module**`build.gradle` file:
Snapshots of the development version are available in [JFrog's snapshots repository](https://oss.jfrog.org/oss-snapshot-local/).
129
40
Add the repo below to download `SNAPSHOT` releases.
130
41
@@ -135,13 +46,7 @@ repositories {
135
46
}
136
47
```
137
48
138
-
### Misc
139
-
140
-
- If you include [Jitpack.io](https://jitpack.io/) dependencies in your project, it is important to review the order of the repositories available to your app module
141
-
- Because of the library's artifact ID, Jitpack might be tempted to resolve the dependency on its own, which could lead to an error during Gradle's configuration time
142
-
- If you're going to bump up the major version number we recommend to refer to [migration guide](https://github.com/hotchemi/PermissionsDispatcher/blob/master/doc/migration_guide.md)
PermissionsDispatcher introduces only a few annotations, keeping its general API concise:
14
+
15
+
> NOTE: Annotated methods must not be `private`.
16
+
17
+
|Annotation|Required|Description|
18
+
|---|---|---|
19
+
|`@RuntimePermissions`|**✓**|Register an `Activity` or `Fragment`(we support both) to handle permissions|
20
+
|`@NeedsPermission`|**✓**|Annotate a method which performs the action that requires one or more permissions|
21
+
|`@OnShowRationale`||Annotate a method which explains why the permission/s is/are needed. It passes in a `PermissionRequest` object which can be used to continue or abort the current permission request upon user input|
22
+
|`@OnPermissionDenied`||Annotate a method which is invoked if the user doesn't grant the permissions|
23
+
|`@OnNeverAskAgain`||Annotate a method which is invoked if the user chose to have the device "never ask again" about a permission|
Upon compilation, PermissionsDispatcher generates a class for `MainActivityPermissionsDispatcher`([Activity Name] + PermissionsDispatcher), which you can use to safely access these permission-protected methods.
61
+
62
+
The only step you have to do is delegating the work to this helper class:
Include the following in your **app module**`build.gradle` file:
14
-
15
-
`${latest.version}` is [](https://bintray.com/hotchemi/maven/permissionsdispatcher/_latestVersion)
0 commit comments