Closed hungcuongDev closed 2 years ago
I found the problem, the problem is in the access permission of android
Hi, can you please tell what you did regarding access permission to fix it ? I have the same issue on android even though I followed the set up process carefully. Thank you
I'm having this same issue @hungcuongDev . What permission did you add?
Commenting that I literally just went into settings on my phone for the app and enabled all of the available permissions (MICROPHONE, STORAGE, CAMERA, CALENDAR). And then it worked just fine.
Before calling the connect function, use this function to check permissions
======================================================== export const checkPermissions = (callback?: any) => { const iosPermissions = [PERMISSIONS.IOS.CAMERA, PERMISSIONS.IOS.MICROPHONE]; const androidPermissions = [ PERMISSIONS.ANDROID.CAMERA, PERMISSIONS.ANDROID.RECORD_AUDIO, ]; checkMultiple( Platform.OS === 'ios' ? iosPermissions : androidPermissions, ).then(statuses => { const [CAMERA, AUDIO] = Platform.OS === 'ios' ? iosPermissions : androidPermissions; if ( statuses[CAMERA] === RESULTS.UNAVAILABLE || statuses[AUDIO] === RESULTS.UNAVAILABLE ) { Alert.alert('Error', 'Hardware to support video calls is not available'); } else if ( statuses[CAMERA] === RESULTS.BLOCKED || statuses[AUDIO] === RESULTS.BLOCKED ) { Alert.alert( 'Error', 'Permission to access hardware was blocked, please grant manually', ); } else { if ( statuses[CAMERA] === RESULTS.DENIED && statuses[AUDIO] === RESULTS.DENIED ) { requestMultiple( Platform.OS === 'ios' ? iosPermissions : androidPermissions, ).then(newStatuses => { if ( newStatuses[CAMERA] === RESULTS.GRANTED && newStatuses[AUDIO] === RESULTS.GRANTED ) { callback && callback(); } else { Alert.alert('Error', 'One of the permissions was not granted'); } }); } else if ( statuses[CAMERA] === RESULTS.DENIED || statuses[AUDIO] === RESULTS.DENIED ) { request(statuses[CAMERA] === RESULTS.DENIED ? CAMERA : AUDIO).then( result => { if (result === RESULTS.GRANTED) { callback && callback(); } else { Alert.alert('Error', 'Permission not granted'); } }, ); } else if ( statuses[CAMERA] === RESULTS.GRANTED || statuses[AUDIO] === RESULTS.GRANTED ) { callback && callback(); } } }); };
Steps to reproduce
Expected behaviour
Tell us what should happen
Actual behaviour
Environment
Node.js version:
React Native version: 0.66.0
React Native platform + platform version: iOS 11.0
react-native-twilio-video-webrtc
Version: master