Skip to content

Commit

Permalink
fix: set Foreground Service Behavior IMMEDIATE (WPB-5512) (#3666)
Browse files Browse the repository at this point in the history
  • Loading branch information
ohassine authored Nov 27, 2024
1 parent 4c4b86f commit 8e66a7b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import android.app.Notification
import android.content.Context
import android.service.notification.StatusBarNotification
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationCompat.FOREGROUND_SERVICE_IMMEDIATE
import androidx.core.app.NotificationManagerCompat
import com.wire.android.R
import com.wire.android.appLogger
Expand Down Expand Up @@ -199,6 +200,7 @@ class CallNotificationBuilder @Inject constructor(
.setOngoing(true)
.setSilent(true)
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
.setForegroundServiceBehavior(FOREGROUND_SERVICE_IMMEDIATE)
.addAction(getHangUpCallAction(context, conversationIdString, userIdString))
.setFullScreenIntent(outgoingCallPendingIntent(context, conversationIdString), true)
.setContentIntent(outgoingCallPendingIntent(context, conversationIdString))
Expand Down Expand Up @@ -254,6 +256,7 @@ class CallNotificationBuilder @Inject constructor(
.setAutoCancel(true)
.setOngoing(true)
.setUsesChronometer(true)
.setForegroundServiceBehavior(FOREGROUND_SERVICE_IMMEDIATE)
.addAction(getHangUpCallAction(context, conversationIdString, userIdString))
.addAction(getOpenOngoingCallAction(context, conversationIdString))
.setFullScreenIntent(openOngoingCallPendingIntent(context, conversationIdString), true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ class PersistentWebSocketService : Service() {
.setSmallIcon(R.drawable.websocket_notification_icon_small)
.setContentIntent(openAppPendingIntent(this))
.setCategory(NotificationCompat.CATEGORY_SERVICE)
.setForegroundServiceBehavior(NotificationCompat.FOREGROUND_SERVICE_IMMEDIATE)
.setAutoCancel(false)
.setOngoing(true)
.build()
Expand Down

0 comments on commit 8e66a7b

Please sign in to comment.