Skip to content

Commit

Permalink
fix: persistent web socket service crashing when started in android 14 (
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamadJaara committed Nov 16, 2023
1 parent bcb8870 commit e2fa0a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

Expand Down Expand Up @@ -261,7 +262,9 @@

<service
android:name=".services.PersistentWebSocketService"
android:exported="false" />
android:foregroundServiceType="specialUse"
android:exported="false">
</service>

<service
android:name=".services.OngoingCallService"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ import android.app.Notification
import android.app.Service
import android.content.Context
import android.content.Intent
import android.content.pm.ServiceInfo
import android.os.IBinder
import androidx.core.app.NotificationCompat
import androidx.core.app.ServiceCompat
import com.wire.android.R
import com.wire.android.appLogger
import com.wire.android.di.CurrentSessionFlowService
Expand Down Expand Up @@ -128,7 +130,7 @@ class PersistentWebSocketService : Service() {
.setOngoing(true)
.build()

startForeground(PERSISTENT_NOTIFICATION_ID, notification)
ServiceCompat.startForeground(this, PERSISTENT_NOTIFICATION_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE)
}

override fun onDestroy() {
Expand Down

0 comments on commit e2fa0a7

Please sign in to comment.