From a860c7a536a40bccf7e4aecd5c5b5d758b4da9b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20K=C4=85kol?= Date: Wed, 24 Apr 2024 15:16:05 +0200 Subject: [PATCH] change onTaskRemoved to onDestory method function in ScreencastService v2 --- MembraneRTC/src/main/AndroidManifest.xml | 30 +++++++++---------- .../rtc/media/screencast/ScreencastService.kt | 18 +---------- 2 files changed, 16 insertions(+), 32 deletions(-) diff --git a/MembraneRTC/src/main/AndroidManifest.xml b/MembraneRTC/src/main/AndroidManifest.xml index 2802ad4..64f9fe4 100644 --- a/MembraneRTC/src/main/AndroidManifest.xml +++ b/MembraneRTC/src/main/AndroidManifest.xml @@ -1,18 +1,18 @@ - + - - - - - + + + + + + - - - - + + + + \ No newline at end of file diff --git a/MembraneRTC/src/main/java/org/membraneframework/rtc/media/screencast/ScreencastService.kt b/MembraneRTC/src/main/java/org/membraneframework/rtc/media/screencast/ScreencastService.kt index d78d6de..15950be 100644 --- a/MembraneRTC/src/main/java/org/membraneframework/rtc/media/screencast/ScreencastService.kt +++ b/MembraneRTC/src/main/java/org/membraneframework/rtc/media/screencast/ScreencastService.kt @@ -15,7 +15,7 @@ import androidx.core.app.NotificationCompat const val TAG = "SCREENCAST" -internal class ScreencastService : Service() { +open class ScreencastService : Service() { private var binder: IBinder = ScreencastBinder() private var bindCount = 0 @@ -47,21 +47,6 @@ internal class ScreencastService : Service() { startForeground(notificationId ?: DEFAULT_NOTIFICATION_ID, properNotification) } - override fun onDestroy() { - Log.d(TAG, "onDestroy") - - stopForeground(true) - stopSelf() - } - - override fun onTaskRemoved(rootIntent: Intent?) { - Log.d(TAG, "onTaskRemoved") - - super.onTaskRemoved(rootIntent) - stopForeground(true) - stopSelf() - } - @RequiresApi(Build.VERSION_CODES.O) private fun createNotificationChannel() { Log.d(TAG, "createNotificationChannel") @@ -84,7 +69,6 @@ internal class ScreencastService : Service() { bindCount-- if (bindCount == 0) { - stopForeground(true) stopSelf() }