[android] Cannot set custom notification icon
See original GitHub issue- What version of RN and react-native-fcm are you running? 11.2.0
- What device are you using? (e.g iOS9 emulator, Android 6 device)? Android 8.0 (OnePlus 5)
- Is your app running in foreground, background or not running? background / not running
I am trying to change the notification icon. But so far I have not been able to do that. I have read tons of articles about this, but I have no idea what’s wrong with my setup. Everything else works as expected.
AndroidManifest.xml
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/ic_notification" />
<meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/primary" />
The colour is actually working and I see the notification icons tinted:
But they do not have the expected shape. I tried several things.
- I tried to copy the icons from the firebase example project.
- I created custom icons and added them to mipmap and drawables
None of that worked so far. If anyone has an idea what might be wrong, I would be very happy for any hint / help. What’s really weird is that android-shaped icon with the droid. I have no idea where that is coming from.
Icon sizes are according to those guides:
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Icon not displaying in notification, white square shown instead
Right-click on your res folder > New > Image Asset. You will then see Configure Image Assets as shown in the image below....
Read more >Can't Change Default Notification Icon In Android? · Issue #1077
Description: I'm trying to change the default notification "bell icon" in the app. I'm following this guide from Documentation.
Read more >Android: Notification Icons - OneSignal Documentation
Adding custom icons to some or all of your notifications. Works with Android (and ... If you do not set a large icon,...
Read more >Customizing notifications - Android / Advanced - Batch
Setting up custom push icons. Overview. Android lets you customise the way your notifications look: ... Here's how to set a custom large...
Read more >Create a Custom Notification Layout | Android Developers
If you need a custom layout, you can apply NotificationCompat.DecoratedCustomViewStyle to your notification. This API allows you to provide a ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There is effectively a bug with the version 11.8.0, just downgrade to 11.6.2
Had the same issue. Don’t downgrade, you can upgrade all google/firebase dependencies to 15+. My list of dependencies:
I also had to update
react-native-firebase
to4.2.0
in the process. Check out their releases page and go back to your version and work your way back to4.2.0
with breaking changes and upgrade notes:4.0.0
and4.2.0
are the most important parts, containing information on upgradinggradle
to4.4
. For me it wasn’t directly clear I had to change allcompile
parts toimplementation
inandroid/app/build.gradle
. Also. I had to addflavorDimensions
after upgradinggradle
:Last but not least. Check if your iOS build still works. I had to update
cocoapods
and somereact-native-firebase
initialization code.But after that, my push icon worked 😃