我正在使用后端作为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" />
答案 0 :(得分:6)
Badge App图标是在Nougat中引入的,即Android 7手机版Android 7。因此,您的上述代码适用于Moto G Android 7,而不是之前的版本。 现在,要修复以前的Android版本,你需要了解应用程序启动器中的徽章图标是特定于启动器的。 实现以前版本支持的最佳方法是使用此lib:ShortcutBadger