Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
change onTaskRemoved to onDestory method function in ScreencastServic…
Browse files Browse the repository at this point in the history
…e v2
  • Loading branch information
karkakol committed Apr 24, 2024
1 parent 682bcda commit a860c7a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 32 deletions.
30 changes: 15 additions & 15 deletions MembraneRTC/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<manifest package="org.membraneframework.rtc"
xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />

<application>
<service
android:name="org.membraneframework.rtc.media.screencast.ScreencastService"
android:enabled="true"
android:foregroundServiceType="mediaProjection"
android:stopWithTask="true" />
</application>
</manifest>
<application>
<service
android:name="org.membraneframework.rtc.media.screencast.ScreencastService"
android:enabled="true"
android:foregroundServiceType="mediaProjection"
android:stopWithTask="true" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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")
Expand All @@ -84,7 +69,6 @@ internal class ScreencastService : Service() {
bindCount--

if (bindCount == 0) {
stopForeground(true)
stopSelf()
}

Expand Down

0 comments on commit a860c7a

Please sign in to comment.