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
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) {
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.
267
206
268
207
269
208
## Automatic Basic Behavior:
@@ -301,8 +240,6 @@ Note: iOS only supports `auto` currently.
301
240
| setSpeakerphoneOn(`enable: ?boolean`) |:smile:|:rage:| toggle speaker ON/OFF once. but not force</br>default: false |
302
241
| 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 |
303
242
| 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 |
306
243
| async getAudioUriJS() |:smile:|:smile:| get audio Uri path. this would be useful when you want to pass Uri into another module. |
307
244
| 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.|
308
245
| stopRingtone() |:smile:|:smile:| stop play ringtone if previous started via `startRingtone()`|
0 commit comments