Problem:
A developer using the Agora Audio Calling feature in their app is encountering permission issues related to FOREGROUND_SERVICE_MEDIA_PROJECTION even if they are not sharing the screen.
Symptoms:
During the build process, at lines 574 and 580 (as shown in the image below), permission-related issues arise, which seem to be caused by the Agora SDK. This is when is using only the audio call feature, not video calling.
Root Cause:
The issue arises since the React Native Agora SDK package comes with the screen sharing SDK as a dev dependency, which then compiles at build and adds the media projection permissions.
Solution:
If you are not using screen sharing feature in your app, you should exclude the screen sharing modules in your app/build.gradle directly as below and compile again.
signingConfigs{
....
}
//this goes in here somewhere
configurations.configureEach {
exclude group: "io.agora.rtc", module: "full-screen-sharing"
}
compileOptions{
...
}
Related Article:
https://www.npmjs.com/package/react-native-agora/v/4.5.0?activeTab=readme