我正在使用后端作为 python 实现 fcm,每当推送通知出现时我都需要徽章应用程序图标,但它不适用于除 moto g android 7 之外的大多数 android 手机。
我在 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>
这是我在 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" />
最佳答案
Badge 应用程序图标是在 Nougat 中引入的,即适用于 Stock Android 手机的 Android 7。因此,您上面的代码适用于 Moto G Android 7 而不是之前的版本。 现在,要在以前的 Android 版本上修复它,您需要了解应用启动器中的徽章图标是特定于启动器的。 获得以前版本支持的最佳方法是使用此库:ShortcutBadger
关于android - Fcm 徽章不显示在 android 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44048707/