Fcm徽章未显示在android中

Avi*_*ash 4 android

我正在实现fcm与后端作为python,我需要徽章应用程序图标每当推送通知来,但它不工作的大部分Android手机除了moto g android 7.

我在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>
Run Code Online (Sandbox Code Playgroud)

这是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" />
Run Code Online (Sandbox Code Playgroud)

Pra*_*ate 6

徽章App图标是在Nougat中推出的,即适用于Android手机的Android 7.因此,您的上述代码适用于Moto G Android 7,而不是之前的版本.现在,要修复以前的Android版本,您需要了解应用程序启动器中的徽章图标是特定于启动器的.实现以前版本支持的最佳方法是使用此lib:ShortcutBadger