Kanta Asada 6 anni fa
parent
commit
cac15f6057
1 ha cambiato i file con 22 aggiunte e 3 eliminazioni
  1. 22
    3
      README.md

+ 22
- 3
README.md Vedi File

@@ -187,15 +187,15 @@ 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 => {
198
+Permissions.request('notification', { type: ['alert', 'badge'] }).then(response => {
199 199
   this.setState({ notificationPermission: response })
200 200
 })
201 201
 ```
@@ -254,6 +254,25 @@ You can find more informations about this issue in #46.
254 254
 * You can request write access to any of these types by also including the
255 255
   appropriate write permission in the `AndroidManifest.xml` file. Read more
256 256
   [here](https://developer.android.com/guide/topics/security/permissions.html#normal-dangerous).
257
+
258
+* The optional rationale argument will show a dialog prompt.
259
+
260
+```js
261
+// example
262
+Permissions.request(
263
+  'camera',
264
+  {
265
+    rationale: {
266
+      'title': 'Cool Photo App Camera Permission',
267
+      'message': 'Cool Photo App needs access to your camera ' +
268
+                 'so you can take awesome pictures.'
269
+    },
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