Anu*_*Anu 7 android push-notification react-native
我已经按照此链接在我的应用程序中执行推送通知 https://github.com/zo0r/react-native-push-notification/tree/a359e5c00954aa324136eaa9808333d6ca246171
目前显示默认的应用启动器图标.我想改变它.有没有办法做到这一点?
rah*_*rld 19
您必须遵循通知图标链接的一些规则
首先,生成各种大小的通知图标链接。并输入图标名称ic_notification。
然后移动ic_notification文件夹中相应文件夹中的所有尺寸,android/app/main/res/mipmap并在AndroidManifest.xml文件中添加以下行。
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/ic_notification" />
小智 9
在 AndroidManifest.xml 中添加以下行
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/ic_notification" />
Run Code Online (Sandbox Code Playgroud)
创建自定义图标 ic_notification 并将它们添加到 mipmap 和 drawable 文件夹
你应该先在所有android/app/src/main/res/mipmap-*中添加新图标
在所有文件夹中注意启动mipmap-*添加具有相同名称并具有适当分辨率的新图标
然后在您发送的通知对象中可以添加它的名称
{
largeIcon: "ic_launcher", // (optional) default: "ic_launcher"
smallIcon: "ic_notification", // (optional) default: "ic_notification" with fallback for "ic_launcher"
}
PushNotification.configure({
largeIcon: "ic_launcher",
smallIcon: "ic_notification",
})
Run Code Online (Sandbox Code Playgroud)
小智 8
我通过在应用程序关闭标记之前在 AndroidManifest.xml 中添加以下代码找到了解决方案:
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icon" />
Run Code Online (Sandbox Code Playgroud)
在通知图标生成器中生成各种尺寸的通知图标。在通知图标生成器站点上,在生成和下载文件之前设置以下选项。请注意,如果您使用自己的图像,背景必须是透明的:
notification_icon下载文件后,将所有内容解压到 Android > src > main > res
| 归档时间: |
|
| 查看次数: |
7583 次 |
| 最近记录: |