Skip to content

Commit

Permalink
fix: Declare foreground service type
Browse files Browse the repository at this point in the history
Change-Id: I4f14fcaf7c5a22a12bb6e4149be48f5870f183dc
  • Loading branch information
XayahSuSuSu committed Nov 17, 2024
1 parent 4644b81 commit 0c9088f
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import android.annotation.SuppressLint
import android.app.Service
import android.content.Context
import android.content.Intent
import android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE
import android.os.Binder
import android.os.Build
import android.os.IBinder
import android.view.SurfaceControlHidden
import com.xayah.core.data.repository.TaskRepository
Expand Down Expand Up @@ -33,7 +35,11 @@ import kotlinx.coroutines.sync.withLock

internal abstract class AbstractProcessingService : Service() {
override fun onBind(intent: Intent): IBinder {
startForeground(1, NotificationUtil.getForegroundNotification(applicationContext))
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
startForeground(1, NotificationUtil.getForegroundNotification(applicationContext), FOREGROUND_SERVICE_TYPE_SPECIAL_USE)
} else {
startForeground(1, NotificationUtil.getForegroundNotification(applicationContext))
}
return mBinder
}

Expand Down

0 comments on commit 0c9088f

Please sign in to comment.