From 648b0a61da0f912d8a4be6025a7a3b5a64ffa01d Mon Sep 17 00:00:00 2001 From: Brazol Date: Mon, 23 Dec 2024 12:49:48 +0100 Subject: [PATCH] stop foreground service when app is killed --- .../stream_video_flutter/service/StreamCallService.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/stream_video_flutter/android/src/main/kotlin/io/getstream/video/flutter/stream_video_flutter/service/StreamCallService.kt b/packages/stream_video_flutter/android/src/main/kotlin/io/getstream/video/flutter/stream_video_flutter/service/StreamCallService.kt index 8489ee41b..e976ba3ca 100644 --- a/packages/stream_video_flutter/android/src/main/kotlin/io/getstream/video/flutter/stream_video_flutter/service/StreamCallService.kt +++ b/packages/stream_video_flutter/android/src/main/kotlin/io/getstream/video/flutter/stream_video_flutter/service/StreamCallService.kt @@ -69,6 +69,14 @@ open class StreamCallService : Service() { notificationPayload = NotificationPayload() } + override fun onTaskRemoved(rootIntent: Intent?) { + super.onTaskRemoved(rootIntent) + + // Cleanup when the app is swiped away + stopForeground(true) + stopSelf() + } + override fun onBind(intent: Intent?): IBinder? = null private fun startForeground() {