如何更改 android 中的 Parse 推送通知图标?
How to change Parse push notification icon in android?
在我的应用程序中,我使用解析云代码向 user.By 使用默认通知图标的应用程序发送推送通知 icon.but 我想更改通知图标。我在清单 xml
中使用了下面的代码
<meta-data android:name="com.parse.push.notification_icon" android:resource="@drawable/noti_icon"/>
但图标不会改变。有什么办法可以实现吗??
在PushService
中,每个setDefaultPushCallback()
和subscribe()
方法允许一个额外的指定图标的参数:
PushService.setDefaultPushCallback(context, SomeActivity.class, R.drawable.customIcon)
PushService.subscribe(context, "ChannelName", SomeActivity.class, R.drawable.customIcon)
或者您可以在“设置”下的 Parse.com 上上传图像,然后在“图标图像”下上传图像。
官方在使用Parse接收推送通知时更改Android推送通知图标的方法,如Parse Android docs for push notifications中所述:
重要
确保您要使用的图像遵循 Icon Reference Chart section for Notification icons - 特别是:
They should be flat (no gradients), white and face-on perspective
如果您的图标违反其中一项要求,您的图标将显示为白色框。
将下面这行写到Manifest;
<meta-data android:name="com.parse.push.notification_icon" android:resource="@drawable/pushicon"/>
请在 96X96 中使用 88X88 的白色图像 canvas。
这是图标;它是白色的。 (!)
这是结果
在我的应用程序中,我使用解析云代码向 user.By 使用默认通知图标的应用程序发送推送通知 icon.but 我想更改通知图标。我在清单 xml
中使用了下面的代码<meta-data android:name="com.parse.push.notification_icon" android:resource="@drawable/noti_icon"/>
但图标不会改变。有什么办法可以实现吗??
在PushService
中,每个setDefaultPushCallback()
和subscribe()
方法允许一个额外的指定图标的参数:
PushService.setDefaultPushCallback(context, SomeActivity.class, R.drawable.customIcon)
PushService.subscribe(context, "ChannelName", SomeActivity.class, R.drawable.customIcon)
或者您可以在“设置”下的 Parse.com 上上传图像,然后在“图标图像”下上传图像。
官方在使用Parse接收推送通知时更改Android推送通知图标的方法,如Parse Android docs for push notifications中所述:
重要
确保您要使用的图像遵循 Icon Reference Chart section for Notification icons - 特别是:
They should be flat (no gradients), white and face-on perspective
如果您的图标违反其中一项要求,您的图标将显示为白色框。
将下面这行写到Manifest;
<meta-data android:name="com.parse.push.notification_icon" android:resource="@drawable/pushicon"/>
请在 96X96 中使用 88X88 的白色图像 canvas。
这是图标;它是白色的。 (!)
这是结果