Skip to content

Commit

Permalink
[PBE-5625] Stop the call service if its running when cleaning up the …
Browse files Browse the repository at this point in the history
…video client (#1155)

* Stop the call service if its running when cleaning up the video client

* Add safe call just in case the stopService method fails
  • Loading branch information
aleksandar-apostolov authored Aug 22, 2024
1 parent 7e9734c commit 9e0af19
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import io.getstream.video.android.core.model.UpdateUserPermissionsData
import io.getstream.video.android.core.model.toRequest
import io.getstream.video.android.core.notifications.NotificationHandler
import io.getstream.video.android.core.notifications.internal.StreamNotificationManager
import io.getstream.video.android.core.notifications.internal.service.CallService
import io.getstream.video.android.core.permission.android.DefaultStreamPermissionCheck
import io.getstream.video.android.core.permission.android.StreamPermissionCheck
import io.getstream.video.android.core.socket.ErrorResponse
Expand Down Expand Up @@ -205,6 +206,13 @@ internal class StreamVideoImpl internal constructor(
// call cleanup on the active call
val activeCall = state.activeCall.value
activeCall?.leave()
// Stop the call service if it was running
if (runForegroundService) {
safeCall {
val serviceIntent = CallService.buildStopIntent(context)
context.stopService(serviceIntent)
}
}
}

/**
Expand Down

0 comments on commit 9e0af19

Please sign in to comment.