From e43a328c6f25e932cc3c908da4b4c496b02105e3 Mon Sep 17 00:00:00 2001 From: Parvesh Monu Date: Tue, 5 Nov 2024 19:10:15 +0530 Subject: [PATCH] Improve push notification service initialization (#21553) --- .../ethereum/pushnotifications/PushNotificationHelper.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/react-native-status/android/src/main/java/im/status/ethereum/pushnotifications/PushNotificationHelper.java b/modules/react-native-status/android/src/main/java/im/status/ethereum/pushnotifications/PushNotificationHelper.java index bd85f4f050..899f8ab96b 100644 --- a/modules/react-native-status/android/src/main/java/im/status/ethereum/pushnotifications/PushNotificationHelper.java +++ b/modules/react-native-status/android/src/main/java/im/status/ethereum/pushnotifications/PushNotificationHelper.java @@ -870,7 +870,11 @@ public class PushNotificationHelper { public void start() { Log.e(LOG_TAG, "Starting Foreground Service"); Intent serviceIntent = new Intent(context, ForegroundService.class); - context.startService(serviceIntent); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + context.startForegroundService(serviceIntent); + } else { + context.startService(serviceIntent); + } this.registerBroadcastReceiver(); }