# React Native - Android - Notification - bad icon, no title, no body

**URL:** <https://community.sendbird.com/t/react-native-android-notification-bad-icon-no-title-no-body/2746>\
**Category:** JavaScript\
**Tags:** group-channel, push-notification\
**Created:** [July 27, 2021, 11:42am UTC](https://community.sendbird.com/t/react-native-android-notification-bad-icon-no-title-no-body/2746 "2021-07-27T11:42:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vladislav\_Vodicka](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/vladislav_vodicka/32/1439_2.png) [@Vladislav\_Vodicka](https://community.sendbird.com/u/Vladislav_Vodicka)\
**Post date:** [July 27, 2021, 11:42am UTC](https://community.sendbird.com/t/react-native-android-notification-bad-icon-no-title-no-body/2746/1 "2021-07-27T11:42:36Z")

</div>

Hi,  
my application integrates notifications. APN for iOS, firebase for android. Unfortunately, android notifications are displaying wrong. This issue is only sendbird related, because when I send test (or other) message from firebase or my backend, it displays correctly. This issue has only android, iOS displays it correctly. Device displays wrong notification regardless on message type (user message, admin message…everything looks the same). See the pictures.

Wrong:

> **[Screenshot-1627385824](https://ibb.co/yXNZPqT)**
>
> Image Screenshot-1627385824 hosted in ImgBB

Expected:

> **[Screenshot-1627385836](https://ibb.co/Xx1LdK1)**
>
> Image Screenshot-1627385836 hosted in ImgBB

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [July 27, 2021, 2:09pm UTC](https://community.sendbird.com/t/react-native-android-notification-bad-icon-no-title-no-body/2746/2 "2021-07-27T14:09:53Z")

</div>

Hi @Vladislav_Vodicka,

Welcome to the Sendbird Community. Could you share with us how you’ve implemented notifications within your Android application? It would help us better understand the problem.

---

<div class="post-metadata">

**Author:** ![Vladislav\_Vodicka](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/vladislav_vodicka/32/1439_2.png) [@Vladislav\_Vodicka](https://community.sendbird.com/u/Vladislav_Vodicka)\
**Post date:** [July 27, 2021, 2:31pm UTC](https://community.sendbird.com/t/react-native-android-notification-bad-icon-no-title-no-body/2746/3 "2021-07-27T14:31:36Z")

</div>

Actually everything needed for notifications to appear happens in this method:

```auto
export const registerForPushNotificationsAsync = async (sb: SendBird.SendBirdInstance): Promise<string> => {
  // Prevent trying to register for notifications on iOS simulator
  if (!Constants.isDevice && Platform.OS === 'ios') return ''

  const APNSToken = await messaging().getAPNSToken()
  const FCMToken = await messaging().getToken()

  if (Platform.OS === 'ios') {
    try {
      const status = await sb.registerAPNSPushTokenForCurrentUser(APNSToken || '')
      // eslint-disable-next-line no-console
      console.log('registerAPNSPushTokenForCurrentUser status:', status)
    } catch (error) {
      // Handle error.
    }
  } else {
    try {
      const status = await sb.registerGCMPushTokenForCurrentUser(FCMToken)
      // Do something in response to a successful registration.
      // eslint-disable-next-line no-console
      console.log('registerGCMPushTokenForCurrentUser status:', status)
    } catch (error) {
      // Handle error.
    }
  }

  return FCMToken
}

```

That is called after login.

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [July 27, 2021, 2:37pm UTC](https://community.sendbird.com/t/react-native-android-notification-bad-icon-no-title-no-body/2746/4 "2021-07-27T14:37:41Z")

</div>

Hi @Vladislav_Vodicka,

How about when you receive the notification? In our documentation we talk about how to handle a Payload from FCM: [Push notifications | Chat Android SDK | Sendbird Docs](https://sendbird.com/docs/chat/v3/android/guides/push-notifications#2-push-notifications-for-fcm-3-step-5-handle-an-fcm-message-payload)

Could you share with us how you’ve implemented this?

---

<div class="post-metadata">

**Author:** ![Vladislav\_Vodicka](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/vladislav_vodicka/32/1439_2.png) [@Vladislav\_Vodicka](https://community.sendbird.com/u/Vladislav_Vodicka)\
**Post date:** [July 27, 2021, 2:57pm UTC](https://community.sendbird.com/t/react-native-android-notification-bad-icon-no-title-no-body/2746/5 "2021-07-27T14:57:55Z")

</div>

Thanks for a reply. React native handles it, but it looks like my problem is independent to how I handle the notification. But to be sure, here is effect in my App.tsx which handles it:

```auto
useEffect(() => {
    Notifications.registerRemoteNotifications()

    const notificationOpenedSubscription = Notifications.events().registerNotificationOpened(handleNotificationOpen)

    const notificationReceivedForegroundSubscription = Notifications.events().registerNotificationReceivedForeground(
      (notification: Notification, completion: (response: NotificationCompletion) => void) => {
        const currentRoute = navigationRef.current?.getCurrentRoute()

        if (
          _.get(currentRoute, 'params.report.sendbirdChannelUrl') ===
          _.get(notification, 'payload.sendbird.channel.channel_url')
        ) {
          completion({})
          return
        }

        // Calling completion on iOS with `alert: true` will present the native iOS inApp notification.
        completion({alert: true, sound: true, badge: true})
      },
    )

    if (Platform.OS === 'ios') {
      const handleInitialNotification = async () => {
        const notification = await Notifications.getInitialNotification()
        if (notification) await handleNotificationOpen(notification)
      }
      handleInitialNotification()
    }

    messaging().onNotificationOpenedApp(handleNotificationOpen)

    const onMessageUnsubscribe = messaging().onMessage(({data}) => {
      if (!data || !data.sendbird) return

      const sendbird = JSON.parse(data.sendbird)
      const currentRoute = navigationRef.current?.getCurrentRoute()

      if (
        Platform.OS === 'ios' ||
        _.get(currentRoute, 'params.report.sendbirdChannelUrl') === _.get(sendbird, 'channel.channel_url')
      ) {
        return
      }

      // @ts-expect-error Type marks all fields as required which is incorrect
      Notifications.postLocalNotification({
        title: sendbird.push_title,
        body: `${sendbird.sender.name}: ${sendbird.message}`,
        badge: sendbird.unread_message_count,
        payload: {sendbird},
      })
    })

    messaging().setBackgroundMessageHandler(async () => {
      // Intentionally empty, these are handled by react-native-notifications
      // This is set as empty to avoid the following warning:
      // > No background message handler has been set. Set a handler via the "setBackgroundMessageHandler" method.
      // TODO: Investigate the warning "No task registered for key ReactNativeFirebaseMessagingHeadlessTask"
    })

    return () => {
      notificationOpenedSubscription.remove()
      notificationReceivedForegroundSubscription.remove()
      onMessageUnsubscribe()
    }
  }, [])

```

interesting places here are messaging().onMessage and messaging().setBackgroundMessageHandler. The first mentioned is handling notifications received when the app is in the foreground. That “almost” works. I catch the notification and create local notification from its payload using react-native-notifications. Only issue is app logo, which is blank as on the screenshot. messaging().setBackgroundMessageHandler is intentionally left blank. If I duplicate my code from onMessage and recreate localNotification, works similar as in onMessage, but it also duplicates the notification. So device shows 2 notifications instead of one.

I use sendbird v 3.0.153

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [July 29, 2021, 7:22pm UTC](https://community.sendbird.com/t/react-native-android-notification-bad-icon-no-title-no-body/2746/6 "2021-07-29T19:22:53Z")

</div>

Closed on July 29, 2021, 7:22pm UTC



---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [July 29, 2021, 7:23pm UTC](https://community.sendbird.com/t/react-native-android-notification-bad-icon-no-title-no-body/2746/7 "2021-07-29T19:23:00Z")

</div>

Moved to support case.
