File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
app/src/main/java/com/nextcloud/talk/services Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -29,14 +29,14 @@ class CallForegroundService : Service() {
2929
3030 override fun onBind (intent : Intent ? ): IBinder ? = null
3131
32- @Suppress(" ForegroundServiceType" )
3332 override fun onStartCommand (intent : Intent ? , flags : Int , startId : Int ): Int {
3433 val conversationName = intent?.getStringExtra(EXTRA_CONVERSATION_NAME )
3534 val callExtras = intent?.getBundleExtra(EXTRA_CALL_INTENT_EXTRAS )
3635 val notification = buildNotification(conversationName, callExtras)
3736
38- if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .Q ) {
39- val foregroundServiceType = resolveForegroundServiceType(callExtras)
37+ val foregroundServiceType = resolveForegroundServiceType(callExtras)
38+
39+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .R && foregroundServiceType != FOREGROUND_SERVICE_TYPE_ZERO ) {
4040 startForeground(NOTIFICATION_ID , notification, foregroundServiceType)
4141 } else {
4242 startForeground(NOTIFICATION_ID , notification)
@@ -107,6 +107,7 @@ class CallForegroundService : Service() {
107107
108108 companion object {
109109 private const val NOTIFICATION_ID = 47001
110+ private const val FOREGROUND_SERVICE_TYPE_ZERO = 0
110111 private const val EXTRA_CONVERSATION_NAME = " extra_conversation_name"
111112 private const val EXTRA_CALL_INTENT_EXTRAS = " extra_call_intent_extras"
112113
You can’t perform that action at this time.
0 commit comments