Flutter change notification icon

In this article, I will share with you, how to change the icon of the notification from the android side.

The first step is go to in the Android AndroidManifest.xml file 

Add below the line of code   

<application
        android:name="io.flutter.app.FlutterApplication"
        android:label="When Coin"
        android:icon="@mipmap/ic_launcher">
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_icon"
            android:resource="@mipmap/ic_notification" />
     <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme">
</application>

Note: android:icon="@mipmap/ic_launcher" you can also set icon from the drawable folder. An icon should be transparent.

Be careful above code add-in application tag is not in the activity tag.

And the final step is to run your code and send a notification, Now finally change your notification icon.

Tags: