|
@@ -187,17 +187,19 @@ The current supported permissions are:
|
187
|
187
|
|
188
|
188
|
```js
|
189
|
189
|
// example
|
190
|
|
-Permissions.check('location', 'always').then(response => {
|
|
190
|
+Permissions.check('location', { type: 'always' }).then(response => {
|
191
|
191
|
this.setState({ locationPermission: response })
|
192
|
192
|
})
|
193
|
193
|
|
194
|
|
-Permissions.request('location', 'always').then(response => {
|
|
194
|
+Permissions.request('location', { type: 'always' }).then(response => {
|
195
|
195
|
this.setState({ locationPermission: response })
|
196
|
196
|
})
|
197
|
197
|
|
198
|
|
-Permissions.request('notification', ['alert', 'badge']).then(response => {
|
199
|
|
- this.setState({ notificationPermission: response })
|
200
|
|
-})
|
|
198
|
+Permissions.request('notification', { type: ['alert', 'badge'] }).then(
|
|
199
|
+ response => {
|
|
200
|
+ this.setState({ notificationPermission: response })
|
|
201
|
+ },
|
|
202
|
+)
|
201
|
203
|
```
|
202
|
204
|
|
203
|
205
|
* You cannot request microphone permissions on the simulator.
|
|
@@ -254,6 +256,23 @@ You can find more informations about this issue in #46.
|
254
|
256
|
* You can request write access to any of these types by also including the
|
255
|
257
|
appropriate write permission in the `AndroidManifest.xml` file. Read more
|
256
|
258
|
[here](https://developer.android.com/guide/topics/security/permissions.html#normal-dangerous).
|
|
259
|
+
|
|
260
|
+* The optional rationale argument will show a dialog prompt.
|
|
261
|
+
|
|
262
|
+```js
|
|
263
|
+// example
|
|
264
|
+Permissions.request('camera', {
|
|
265
|
+ rationale: {
|
|
266
|
+ title: 'Cool Photo App Camera Permission',
|
|
267
|
+ message:
|
|
268
|
+ 'Cool Photo App needs access to your camera ' +
|
|
269
|
+ 'so you can take awesome pictures.',
|
|
270
|
+ },
|
|
271
|
+}).then(response => {
|
|
272
|
+ this.setState({ cameraPermission: response })
|
|
273
|
+})
|
|
274
|
+```
|
|
275
|
+
|
257
|
276
|
* Permissions are automatically accepted for **targetSdkVersion < 23** but you
|
258
|
277
|
can still use `check()` to check if the user has disabled them from Settings.
|
259
|
278
|
|