File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
vector/src/main/java/im/vector/app/features/call Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 1+ Fix incoming call crash on Android 14+. ([#8964](https://github.com/element-hq/element-android/issues/8964))
Original file line number Diff line number Diff line change @@ -246,9 +246,16 @@ class VectorCallActivity :
246246 == PackageManager .PERMISSION_GRANTED ) {
247247 // Only start the service if the app is in the foreground
248248 if (isAppInForeground()) {
249- Timber .tag(loggerTag.value).v(" Starting microphone foreground service" )
250- val intent = Intent (this , MicrophoneAccessService ::class .java)
251- ContextCompat .startForegroundService(this , intent)
249+ // Starting in Android 14, you can't create a microphone foreground service while your app is in
250+ // the background. If we call startForegroundService the app will crash.
251+ // https://github.com/element-hq/element-android/issues/8964
252+ if (Build .VERSION .SDK_INT < Build .VERSION_CODES .UPSIDE_DOWN_CAKE ) {
253+ Timber .tag(loggerTag.value).v(" Starting microphone foreground service" )
254+ val intent = Intent (this , MicrophoneAccessService ::class .java)
255+ ContextCompat .startForegroundService(this , intent)
256+ } else {
257+ Timber .tag(loggerTag.value).v(" App is in running Android 14+; cannot start microphone service" )
258+ }
252259 } else {
253260 Timber .tag(loggerTag.value).v(" App is not in foreground; cannot start microphone service" )
254261 }
You can’t perform that action at this time.
0 commit comments