自动展开GCM android推送通知中的图像
我成功地将图像设置为以下代码自动展开GCM android推送通知中的图像,android,google-cloud-messaging,Android,Google Cloud Messaging,我成功地将图像设置为以下代码 mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); Bitmap remote_picture = BitmapFactory.decodeResource(getResources(), R.drawable.bg1); NotificationCompat.BigPictureStyle
mNotificationManager = (NotificationManager)
this.getSystemService(Context.NOTIFICATION_SERVICE);
Bitmap remote_picture = BitmapFactory.decodeResource(getResources(), R.drawable.bg1);
NotificationCompat.BigPictureStyle notiStyle = new NotificationCompat.BigPictureStyle();
notiStyle.bigPicture(remote_picture);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, openIntent, PendingIntent.FLAG_CANCEL_CURRENT);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this).setSmallIcon(R.drawable.ic_stat_gcm)
.setContentTitle("Test")
.setStyle(new NotificationCompat.BigTextStyle()
.bigText(data_msg_sort))
.setContentText("123")
.setStyle(notiStyle);
mBuilder.setContentIntent(contentIntent);
mBuilder.setSound(Settings.System.DEFAULT_NOTIFICATION_URI);
mBuilder.setAutoCancel(true);
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
但是,我需要向下滚动通知消息以展开并查看图像。否则,它不会显示在通知中。你能看一下我的代码,给我一些方法来设置图像自动扩展为全尺寸,如下图所示吗
请注意,如果通知区域中存在任何具有较高优先级的通知消息,则您的通知将不会以展开模式显示 因此,您必须将优先级设置为
notification.priority=notification.priority_MAX
,使其处于最高优先级。请注意,如果您也这样做,那么如果存在具有最大优先级的通知,它也可能会被折叠