Fcm icon not showing in android

I am implementing fcm with backend as python, I need an icon badge icon when push notification appears, but it doesn't work on most android phones except moto g android 7.

I did in AndroidManifest.xml:

    <service
        android:name=".fcmnotification.Custom_FirebaseMessagingService">
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT"/>
        </intent-filter>
    </service>

    <service
        android:name=".fcmnotification.Custom_FirebaseInstanceIDService">
        <intent-filter>
            <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
        </intent-filter>
    </service>

      

This is my metadata in AndroidManifest.xml:

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

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

      

+3


source to share


1 answer


The Icon was introduced in Nougat ie Android 7 for Android Android. Hence, your previous code works on Moto G Android 7, not previous versions. Now, to fix this on previous Android versions, you need to understand that the icon icon in app launchers is launcher specific. The best way to achieve legacy support is to use this lib: ShortcutBadger



+6


source







All Articles