Flutter oneSignal notifications icon not set

1,781

Solution 1

use these tool and upload image that is trnasperts http://romannurik.github.io/AndroidAssetStudio/icons-notification.html#source.type=image&source.space.trim=1&source.space.pad=0&name=ic_stat_onesignal_default

for onesignal the folders names is drawable-xxxx so you just download from the tool and extract inside the android\app\src\main\res

Note :- Starting with Android 5, the OS forces Small Notification Icons to be all white when your app targets Android API 21+. If you don't make a correct icon, it will most likely be displayed as a bell or solid white icon in the status bar.

Solution 2

just do some simple things and it changes your default notification icon. I also face this problem in 2021 but I resolve it

in AndroidManifest.xml

<meta-data
            android:name="com.onesignal.messaging.default_notification_icon"
            android:resource="@mipmap/ic_stat_onesignal_default" />

in build.gradle

 buildTypes {
  
  debug {
       defaultConfig {
     manifestPlaceholders = [onesignal_app_id               : "your onesignal app id put here",
                             onesignal_google_project_number: "your project number put here"]
   }
}

}

put your pic in app/main/res/drawable and also in all mipmap with the name "ic_stat_onesignal_default" ..please must use this name otherwise it's not working ..

Share:
1,781
hesham shawky
Author by

hesham shawky

Updated on December 21, 2022

Comments

  • hesham shawky
    hesham shawky over 1 year

    I'm using one signal within my flutter app and everything is fine except the notifications have no icon ( comes with a default bill icon ).

    I have read the documentation for one signal and generated an AssetsImage by Android Studio in PROJECT/android/res/ with name ic_stat_onesignal_default

    Then I built the app using the command flutter run --release on a real device and still, the notification comes with default bill icon instead of my app icon!!

    Is there some code required in the AndroidManifest.xml file too?

  • Ahmed El-Atab
    Ahmed El-Atab over 2 years
    Make sure to uninstall and re-install the app again to apply changes!