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
Copy file name to clipboardExpand all lines: README.md
+23-13Lines changed: 23 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,12 @@ The current supported permissions are:
22
22
| 0.2.5 | 0.33.0 - 0.39.0 |
23
23
*Complies with [react-native-version-support-table](https://github.com/dangnelson/react-native-version-support-table)*
24
24
25
+
### Breaking changes in version 1.0.0
26
+
- Now using React Native's own JS PermissionsAndroid library on Android, which is great because now we no longer have to do any additional linking (on Android)
27
+
- Updated API to be closer to RN's PermissionsAndroid
28
+
- Removed `openSettings()` support on Android (to stay linking-free). There are several NPM modules available for this
29
+
-`restricted` status now supported on Android, although it means something different than iOS
//response is an object mapping type to permission
61
67
this.setState({
@@ -118,18 +124,18 @@ Promises resolve into one of these statuses
118
124
### Methods
119
125
| Method Name | Arguments | Notes
120
126
|---|---|---|
121
-
|`check`|`type`| - Returns a promise with the permission status. See iOS Notes for special cases |
122
-
|`request`|`type`| - Accepts any permission type except `backgroundRefresh`. If the current status is `undetermined`, shows the permission dialog and returns a promise with the resulting status. Otherwise, immediately return a promise with the current status. See iOS Notes for special cases|
123
-
|`checkMultiple`|`[types]`| - Accepts an array of permission types and returns a promise with an object mapping permission types to statuses |
124
-
|`getTypes`|*none*| - Returns an array of valid permission types |
125
-
|`openSettings`|*none*| - *(iOS only - 8.0 and later)* Switches the user to the settings page of your app |
126
-
|`canOpenSettings`|*none*| - *(iOS only)* Returns a boolean indicating if the device supports switching to the settings page |
127
+
|`check()`|`type`| - Returns a promise with the permission status. See iOS Notes for special cases |
128
+
|`request()`|`type`| - Accepts any permission type except `backgroundRefresh`. If the current status is `undetermined`, shows the permission dialog and returns a promise with the resulting status. Otherwise, immediately return a promise with the current status. See iOS Notes for special cases|
129
+
|`checkMultiple()`|`[types]`| - Accepts an array of permission types and returns a promise with an object mapping permission types to statuses |
130
+
|`getTypes()`|*none*| - Returns an array of valid permission types |
131
+
|`openSettings()`|*none*| - *(iOS only - 8.0 and later)* Switches the user to the settings page of your app |
132
+
|`canOpenSettings()`|*none*| - *(iOS only)* Returns a boolean indicating if the device supports switching to the settings page |
127
133
128
134
### iOS Notes
129
135
- Permission type `bluetooth` represents the status of the `CBPeripheralManager`. Don't use this if only need `CBCentralManager`
130
-
- Permission type `location` accepts a second parameter for `requestPermission` and `getPermissionStatus`; the second parameter is a string, either `always` or `whenInUse`(default).
136
+
- Permission type `location` accepts a second parameter for `request()` and `check()`; the second parameter is a string, either `always` or `whenInUse`(default).
131
137
132
-
- Permission type `notification` accepts a second parameter for `requestPermission`. The second parameter is an array with the desired alert types. Any combination of `alert`, `badge` and `sound` (default requests all three)
138
+
- Permission type `notification` accepts a second parameter for `request()`. The second parameter is an array with the desired alert types. Any combination of `alert`, `badge` and `sound` (default requests all three)
133
139
134
140
```js
135
141
///example
@@ -163,9 +169,9 @@ Requires RN >= 0.29.0
163
169
164
170
Uses RN's own `PermissionsAndroid` JS api (http://facebook.github.io/react-native/releases/0.45/docs/permissionsandroid.html)
165
171
166
-
All required permissions also need to be included in the Manifest before they can be requested. Otherwise `requestPermission` will immediately return `denied`.
172
+
All required permissions also need to be included in the Manifest before they can be requested. Otherwise `request()` will immediately return `denied`.
167
173
168
-
Permissions are automatically accepted for targetSdkVersion < 23 but you can still use `getPermissionStatus` to check if the user has disabled them from Settings.
174
+
Permissions are automatically accepted for targetSdkVersion < 23 but you can still use `check()` to check if the user has disabled them from Settings.
169
175
170
176
You can request write access to any of these types by also including the appropriate write permission in the Manifest. Read more here: https://developer.android.com/guide/topics/security/permissions.html#normal-dangerous
171
177
@@ -204,6 +210,10 @@ So before submitting your app to the `AppStore`, make sure that in your `Info.pl
0 commit comments