diff --git a/packages/core-mobile/app/services/fcm/FCMService.ts b/packages/core-mobile/app/services/fcm/FCMService.ts index d83e9f165..217f97379 100644 --- a/packages/core-mobile/app/services/fcm/FCMService.ts +++ b/packages/core-mobile/app/services/fcm/FCMService.ts @@ -6,6 +6,7 @@ import { BalanceChangeEvents, NotificationsBalanceChangeSchema } from 'services/fcm/types' +import { Platform } from 'react-native' type UnsubscribeFunc = () => void @@ -59,6 +60,10 @@ class FCMService { listenForMessagesBackground = (): void => { messaging().setBackgroundMessageHandler(async remoteMessage => { Logger.info('A new FCM message arrived in background', remoteMessage) + if (Platform.OS === 'android') { + //skip for android, FCM sdk handles this already + return + } const result = NotificationsBalanceChangeSchema.safeParse(remoteMessage) if (!result.success) { Logger.error( diff --git a/packages/core-mobile/app/services/notifications/NotificationsService.ts b/packages/core-mobile/app/services/notifications/NotificationsService.ts index 37287d8af..40fd91f3d 100644 --- a/packages/core-mobile/app/services/notifications/NotificationsService.ts +++ b/packages/core-mobile/app/services/notifications/NotificationsService.ts @@ -321,16 +321,14 @@ class NotificationsService { pressAction: { id: PressActionId.OPEN_PORTFOLIO, launchActivity: LAUNCH_ACTIVITY - } + }, + channelId: channelId ?? '' }, data } if (sound) { notification.ios = { sound: sound } } - if (channelId && notification.android) { - notification.android.channelId = channelId - } await notifee.displayNotification(notification).catch(Logger.error) } }