React-native-onesignal: Can't Change Default Notification Icon In Android?

Created on 29 Oct 2020  路  6Comments  路  Source: OneSignal/react-native-onesignal

Description:

I'm trying to change the default notification "bell icon" in the app.
I'm following this guide from Documentation.

Environment

react-native: 0.63.3
react-native-onesignal: 3.9.2

Steps to Reproduce Issue:

  1. Generate icon from Android Asset studio. Named as ic_stat_onesignal_default.
  2. put all folders into android/app/src/main/res/.
  3. Send the small_icon via Api and Onesignal Dashboard. small_icon: 'ic_stat_onesignal_default'
  4. Un-install app and clean build folder then rebuild it, Also generated separate Apk.

Nothing works!
And still got the bell icon as a notification icon :)

Help Wanted

Most helpful comment

After added
AndroidManifest.xml

<meta-data
    android:name="com.google.firebase.messaging.default_notification_icon"
    android:resource="@drawable/ic_stat_onesignal_default" /> // I choose mipmap-xxxhdpi icon size :)

i just was wanted to test if firebase meta-data will work or not and Actually it's work and I got the icon I want!!
have anybody explanation for this!

Edit:
Actually if I set it to com.onesignal.messaging.default_notification_icon will work too.
and you should use the name ic_stat_onesignal_default otherways will not work and will appear the bell default icon.

Possibly wherever you are referencing the android:name from the manifest file, it will tie back to the correct icon regardless of whether you're actually using Firebase. The name/value pair should be all that's important. As long as you have a meta-data tag in the manifest. @thomasciv stackoverflow :)

Thank You It's Work Form Me 鉂わ笍

All 6 comments

After added
AndroidManifest.xml

<meta-data
    android:name="com.google.firebase.messaging.default_notification_icon"
    android:resource="@drawable/ic_stat_onesignal_default" /> // I choose mipmap-xxxhdpi icon size :)

i just was wanted to test if firebase meta-data will work or not and Actually it's work and I got the icon I want!!
have anybody explanation for this!

Edit:
Actually if I set it to com.onesignal.messaging.default_notification_icon will work too.
and you should use the name ic_stat_onesignal_default otherways will not work and will appear the bell default icon.

Possibly wherever you are referencing the android:name from the manifest file, it will tie back to the correct icon regardless of whether you're actually using Firebase. The name/value pair should be all that's important. As long as you have a meta-data tag in the manifest. @thomasciv stackoverflow :)

After added
AndroidManifest.xml

<meta-data
    android:name="com.google.firebase.messaging.default_notification_icon"
    android:resource="@drawable/ic_stat_onesignal_default" /> // I choose mipmap-xxxhdpi icon size :)

i just was wanted to test if firebase meta-data will work or not and Actually it's work and I got the icon I want!!
have anybody explanation for this!

Edit:
Actually if I set it to com.onesignal.messaging.default_notification_icon will work too.
and you should use the name ic_stat_onesignal_default otherways will not work and will appear the bell default icon.

Possibly wherever you are referencing the android:name from the manifest file, it will tie back to the correct icon regardless of whether you're actually using Firebase. The name/value pair should be all that's important. As long as you have a meta-data tag in the manifest. @thomasciv stackoverflow :)

Thank You It's Work Form Me 鉂わ笍

I get this error: Resource 'drawable/ic_stat_onesignal_default' not found in Android Manifest.xml:87.
How do you choose the icon? I have many resolutions in different drawable folders. Could this be the problem?

Howdy @areavisuale ,
This seems like a different problem altogether.

Go to android/app/src/main/res/drawable and check if you have a file with name ic_stat_onesignal_default or not. If not, make sure the names match.

Cheers

Hey @rgomezp,
I guess should the documentation to be updated, With this workaround!
Maybe Many users faced the same issue and that's will help them!

@anastely ,
Thanks for the feedback. Can we close this issue then?

Was this page helpful?
0 / 5 - 0 ratings