android - 使用通知负载时如何为 gcm 通知设置大小图标

标签 android google-cloud-messaging

我正在使用 GCM 9.4.0。作为GCM的官方文档,当使用notificaiton payload时,GCM自己处理通知,通知消息只有一个参数:icon for small icon。

那么,如何同时设置小图标和大图标呢?感谢您的帮助。

最佳答案

尝试使用这个

Notification notification=notificationBuilder.build();
notification.contentView.setImageViewResource(android.R.id.icon, R.drawable.your_large_icon);

builder.setSmallIcon(R.drawable.my_small_icon);
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.my_96px_large_icon);
builder.setLargeIcon(bm);   

关于android - 使用通知负载时如何为 gcm 通知设置大小图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43671215/

相关文章:

php - GCM 返回错误 : field data must be a json array

delphi - 德尔福西雅图的 GCM,无 BAAS

android - 为什么 Android aapt 去掉 assets 的 .gz 文件扩展名?

java - Location Manager.RequestLocationUpdates 使用 pendingIntent 始终广播相同的位置,当 gps 提供商需要很长时间才能获取位置时

android - 如何跟踪android应用程序中的每一次合理点击?

php - 如何使用GCM向应用程序推送消息?

Android gcm 通知有效负载与数据有效负载?

ios - iOS 中的 GCM(Google Cloud Messaging)(通知和数据负载。)

Android 应用程序图标尺寸太小

android - GPS信号采集超时怎么办