From 21c7628da170053904abcefbe34eadbc9666b504 Mon Sep 17 00:00:00 2001 From: Mattermost Build Date: Fri, 2 Aug 2024 18:10:47 +0300 Subject: [PATCH] fix: (MM-59956) Android crash when sharing (#8122) (#8126) (cherry picked from commit 1de7b5e9b7a8029351deed485da527112601ae6f) Co-authored-by: Rahim Rahman --- android/app/src/main/AndroidManifest.xml | 11 +++++++++++ .../main/java/com/mattermost/rnshare/ShareWorker.kt | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 227ee36dccd..96183f307a5 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -21,6 +21,7 @@ + + + + + diff --git a/libraries/@mattermost/rnshare/android/src/main/java/com/mattermost/rnshare/ShareWorker.kt b/libraries/@mattermost/rnshare/android/src/main/java/com/mattermost/rnshare/ShareWorker.kt index 79063c2a08f..09072332ede 100644 --- a/libraries/@mattermost/rnshare/android/src/main/java/com/mattermost/rnshare/ShareWorker.kt +++ b/libraries/@mattermost/rnshare/android/src/main/java/com/mattermost/rnshare/ShareWorker.kt @@ -1,5 +1,6 @@ package com.mattermost.rnshare +import android.content.pm.ServiceInfo import android.content.Context import android.util.Log import androidx.core.app.NotificationCompat @@ -147,7 +148,7 @@ class ShareWorker(context: Context, workerParameters: WorkerParameters) : Worker .setSmallIcon(applicationContext.resources.getIdentifier("ic_notification", "mipmap", applicationContext.packageName)) .setOngoing(true) .build() - return ForegroundInfo(1, notification) + return ForegroundInfo(1, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC) } }