-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash on apps targeting Android 14 (Unable to start foreground service) #1026
Comments
Thank you so much, @wisemuji, for highlighting this crucial issue! I've just talked with @aleksandar-apostolov about it, and he's committed to examining and resolving it as soon as possible. Given the critical nature of the issue, we want you to know that we will provide you with continuous updates. Your input is invaluable to us! |
Any idea when this is going to be release? Now i'm using |
Hi @jesusjav, The issue on Android 14 arises since the video call service was launched before getting proper media permissions (audio, foreground service, etc.), so ensuring the required permissions before launching the call service will resolve the Android 14 permission issue. For now, we'd suggest using the code below:
@OptIn(ExperimentalPermissionsApi::class)
@Composable
private fun EnsureVideoCallPermissions(onPermissionsGranted: () -> Unit) {
// While the SDK will handle the microphone permission,
// its not a bad idea to do it prior to entering any call UIs
val permissionsState = rememberMultiplePermissionsState(
permissions = buildList {
// Access to camera & microphone
add(Manifest.permission.CAMERA)
add(Manifest.permission.RECORD_AUDIO)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
// Allow for foreground service for notification on API 26+
add(Manifest.permission.FOREGROUND_SERVICE)
}
},
)
LaunchedEffect(key1 = Unit) {
permissionsState.launchMultiplePermissionRequest()
}
LaunchedEffect(key1 = permissionsState.allPermissionsGranted) {
if (permissionsState.allPermissionsGranted) {
onPermissionsGranted()
}
}
}
EnsureVideoCallPermissions {
call.join(create = true)
} We will investigate a better way to get proper permissions before/after joining a video call service. Thanks again for reporting this crucial issue! @wisemuji @jesusjav |
Hi all, The reason why this does not work is because, as soon as you call So basically the following code will crash: LaunchCallPermissions(call)
call.join() Why? because There are several ways to solve this issue:
LaunchCallPermissions(call = call, onPermissionsResult = { permissionResult: Map<String, Boolean> ->
// you can query the permissionResult map to see if the required permission were granted
call.join()
})
The above solutions will work with the SDK you are currently using. As for the update, there isn't much that can be done in the case where Thanks again for raising this issue and let us know if we can help you any further. |
@skydoves @aleksandar-apostolov Thank you for clarifying the problem and providing solutions. Looking forward to see the new updates in the SDK, thank you for the heads-up about the upcoming release. 🙌 |
Describe the bug
App targeting Android 14 gets crash when run on Android 14 devices. It occurs regardless of whether I call
LaunchCallPermissions
or not. Removing thetargetSdk = 34
from the gradle file or running it on devices below Android 14 does not crash. After granting permissions to the app manually, it works well too.Tried out other demo apps on Android 14 devices, and they also crashed.
I think the problem is linked to the changes that require foreground service types in Android 14, as shown by the stacktrace.
See all stacktraces
SDK version
To Reproduce
Steps to reproduce the behavior:
targetSdk = 34
block in gradle fileExpected behavior
Does not crash on Android 14
Device:
The text was updated successfully, but these errors were encountered: