Skip to content

Commit 5500e34

Browse files
committed
Updated readme to better reflect current status.
1 parent bbad44c commit 5500e34

File tree

1 file changed

+0
-63
lines changed

1 file changed

+0
-63
lines changed

README.md

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -203,67 +203,6 @@ DeviceEventEmitter.addListener('Proximity', function (data) {
203203

204204
```
205205

206-
## About Permission:
207-
208-
209-
Since version 1.2.0, two functions and a property were added:
210-
211-
```javascript
212-
// --- function
213-
async checkRecordPermission() // return promise
214-
async requestRecordPermission() // return promise
215-
216-
// --- property
217-
recordPermission = 'unknow' or 'granted' or 'denied', default is 'unknow'
218-
```
219-
220-
After incall-manager initialized, it will check current state of record permission and set to `recordPermission` property.
221-
so you can just write below code in your `ComponentDidMount` like:
222-
223-
```javascript
224-
if (InCallManager.recordPermission !== 'granted') {
225-
InCallManager.requestRecordPermission()
226-
.then((requestedRecordPermissionResult) => {
227-
console.log("InCallManager.requestRecordPermission() requestedRecordPermissionResult: ", requestedRecordPermissionResult);
228-
})
229-
.catch((err) => {
230-
console.log("InCallManager.requestRecordPermission() catch: ", err);
231-
});
232-
}
233-
```
234-
235-
We use android support library v4 to check/request permissions.
236-
You should add `compile "com.android.support:support-v4:23.0.1"` in `$your_project/android/app/build.gradle` dependencies on android.
237-
238-
239-
**NOTE for android:**
240-
241-
React Native does not officially support api 23 currently ( it is on api 22 now. see: [RN known issues](https://facebook.github.io/react-native/docs/known-issues.html#android-m-permissions)) and android supports request permission at runtime since api 23, so it will always return 'granted' immediately after calling `checkRecordPermission()` or `requestRecordPermission()`.
242-
243-
If you really need the functionality, you can do the following to make them work but at your own risk:
244-
( I've tested it though, but who knows :) )
245-
246-
Step 1: change your `targetSdkVersion` to 23 in `$your_project/android/app/build.gradle`
247-
Step 2: override `onRequestPermissionsResult` in your `MainActivity.java` like:
248-
249-
```
250-
@Override
251-
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
252-
InCallManagerPackage.onRequestPermissionsResult(requestCode, permissions, grantResults);
253-
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
254-
}
255-
```
256-
257-
Then you can test it on android 6 now.
258-
259-
**Another thing you should know is:**
260-
261-
If you change targetSdkVersion to 23, the `red box` which React Native used to display errors in development mode requires permission `Draw Over Other Apps`.
262-
So in **development mode**, you should manually grant permission in `app settings` on your device or declare `android.permission.SYSTEM_ALERT_WINDOW` in your manifest.
263-
You don't have to do this in **release mode** since there is no red box.
264-
265-
266-
Check out this awesome project: [react-native-android-permissions](https://github.com/lucasferreira/react-native-android-permissions) by @lucasferreira for more information.
267206

268207

269208
## Automatic Basic Behavior:
@@ -301,8 +240,6 @@ Note: iOS only supports `auto` currently.
301240
| setSpeakerphoneOn(`enable: ?boolean`) | :smile: | :rage: | toggle speaker ON/OFF once. but not force</br>default: false |
302241
| setForceSpeakerphoneOn(`flag: ?boolean`) | :smile: | :smile: | true -> force speaker on</br> false -> force speaker off</br> null -> use default behavior according to media type</br>default: null |
303242
| setMicrophoneMute(`enable: ?boolean`) | :smile: | :rage: | mute/unmute micophone</br>default: false</br>p.s. if you use webrtc, you can just use `track.enabled = false` to mute |
304-
| async checkRecordPermission() | :smile: | :smile: | check record permission without promt. return Promise. see **about permission** section above |
305-
| async requestRecordPermission() | :smile: | :smile: | request record permission to user. return Promise. see **about permission** section above |
306243
| async getAudioUriJS() | :smile: | :smile: | get audio Uri path. this would be useful when you want to pass Uri into another module. |
307244
| startRingtone(`ringtone: string, ?vibrate_pattern: array, ?ios_category: string, ?seconds: number`) | :smile: | :smile: | play ringtone. </br>`ringtone`: '_DEFAULT_' or '_BUNDLE_'</br>`vibrate_pattern`: same as RN, but does not support repeat</br>`ios_category`: ios only, if you want to use specific audio category</br>`seconds`: android only, specify how long do you want to play rather than play once nor repeat. in sec.|
308245
| stopRingtone() | :smile: | :smile: | stop play ringtone if previous started via `startRingtone()` |

0 commit comments

Comments
 (0)