question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remote push notification icon issues android

See original GitHub issue

My push notification works with sound, but I can’t see the large icon for both background and foreground remote notifications. Screenshot 2020-08-27 at 10 02 36

Also I get this icon when in the foreground. Screenshot 2020-08-27 at 10 05 35.

AndroidManifest.xml <!-- PUSH Notification --> <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/ic_notification" /> <meta-data android:name="com.dieam.reactnativepushnotification.notification_icon" android:resource="@drawable/ic_notification" /> <meta-data android:name="com.google.firebase.messaging.default_notification_channel_id" android:value="rn-push-notification-channel-id-4-default-300" tools:replace="android:value" /> <!-- Change the value to true to enable pop-up for in foreground (remote-only, for local use ignoreInForeground) --> <meta-data android:name="com.dieam.reactnativepushnotification.notification_foreground" android:value="true"/> <!-- Change the value to false if you don't want the creation of the default channel --> <meta-data android:name="com.dieam.reactnativepushnotification.channel_create_default" android:value="true"/> <!-- Change the resource name to your App's accent color - or any other color you want --> <meta-data android:name="com.dieam.reactnativepushnotification.notification_color" android:resource="@color/white"/> <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationActions" /> <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" /> <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> </receiver> <service android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService" android:exported="false" > <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT" /> </intent-filter> </service> <!-- PUSH Notification -->

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
vgm8commented, Dec 1, 2020

Im having the same problem, icon is not showing in Android when the app is in background and quit. Any solution?

6reactions
aareusoftnetcommented, Sep 7, 2021

I have found the solutions to display the notification icon, if you are using @react-native-firebase/messaging & react-native-push-notification libraries to display the remote notification and local notification, please add the following lines to AndroidManifest.xml file:

<meta-data
            android:name="com.dieam.reactnativepushnotification.notification_color"
            android:resource="@color/ic_notification_color" />
<meta-data
            android:name="com.dieam.reactnativepushnotification.notification_icon"
            android:resource="@drawable/ic_notification" />

<meta-data
            android:name="com.google.firebase.messaging.default_notification_icon"
            android:resource="@drawable/ic_notification" />

<meta-data
            android:name="com.google.firebase.messaging.default_notification_color"
            android:resource="@color/ic_notification_color" />

If you are using local notification then please add the smallIcon field in PushNotificationScheduleObject for example: Screenshot 2021-09-07 at 9 57 20 PM

NOTE: @drawable/ic_notification file must be follow the guidelines provide by Android Developer in link: http://spot.pcc.edu/~mgoodman/developer.android.com/preview/notifications.html Screenshot 2021-09-07 at 9 07 37 PM

You can apply the tint colour of notification icon by adding the field messaging_android_notification_color in firebase.json file like:

{
  "react-native": {
    "crashlytics_debug_enabled": true,
    "messaging_android_notification_color": "@color/ic_notification_color"
  }
}

Read more comments on GitHub >

github_iconTop Results From Across the Web

Icon not displaying in notification, white square shown instead
Cause: For 5.0 Lollipop "Notification icons must be entirely white". If we solve the white icon problem by setting target SDK to 20,...
Read more >
grey square as icon notification android · Issue #730 - GitHub
Hi! my notification works fine on android and ios but in some android devices (motorola) instead of my app icon appear a grey...
Read more >
Notifications Overview | Android Developers
When you issue a notification, it first appears as an icon in the status bar. Figure 1. Notification icons appear on the left...
Read more >
Android Notifications Not Working [ 2022 Ultimate Fixes]
2How to Fix Android Notifications Not Working? ; From the pop-up window, Tap on Restart.
Read more >
Notifications Not Shown - Mobile Push
Notifications Not Shown - Mobile Push · Network issues · Not Targeted In the Push · App Push Permissions Disabled - Device Not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found