我正在使用此插件https://github.com/chemerisuk/cordova-plugin-firebase-messaging获取通知。它说如果我们将此代码放在config.xml中,则可以将自定义图像用作通知。我很困惑,因为这里的图标路径应该是什么。
<config-file parent="/manifest/application" target="app/src/main/AndroidManifest.xml">
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/my_custom_icon_id"/>
</config-file>
如果您是tryig,请在config.xml中为android添加图标。我们有离子应用程序,并且有资源文件夹。我们已经给出了路径。
<config-file parent="/manifest/application/" target="app/src/main/AndroidManifest.xml">
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icon" />
<meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/icon_css" />
</config-file>
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:usesCleartextTraffic="true" />
</edit-config>
<resource-file src="resources/android/color/color.xml" target="app/src/main/res/values/color.xml" />
<resource-file src="resources/android/notification_icon/drawable-mdpi/notification_icon.png" target="app/src/main/res/drawable-mdpi/notification_icon.png" />
<resource-file src="resources/android/notification_icon/drawable-hdpi/notification_icon.png" target="app/src/main/res/drawable-hdpi/notification_icon.png" />
<resource-file src="resources/android/notification_icon/drawable-xhdpi/notification_icon.png" target="app/src/main/res/drawable-xhdpi/notification_icon.png" />
<resource-file src="resources/android/notification_icon/drawable-xxhdpi/notification_icon.png" target="app/src/main/res/drawable-xxhdpi/notification_icon.png" />
<resource-file src="resources/android/notification_icon/drawable-xxxhdpi/notification_icon.png" target="app/src/main/res/drawable-xxxhdpi/notification_icon.png" />
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句