android 多个推送,如何发送多个推送通知并显示它们的数目_android_开发99编程知识库...

我有一个数据和我的应用程序,我想通过推通通知,因这里问题是我没有如何在状态栏。 在我的应用程序中,我从服务器收到 ArrayList的通知。 每个通知应该使用"通知生成器",在 which notify put notify notify,至少在状态栏( 一个带有 3个指示器的icon,而不是 3图标) 中显示 3消息,但我在打开状态栏时显示所有的消息。

我的代码有 :public void sendNotifications(ArrayList messages){

int notifyID = 0;

mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

for(Message message:messages){

Intent notificationIntent = new Intent(getApplicationContext(), MainActivity.class);

PendingIntent contentIntent = PendingIntent.getActivity(getApplicationContext(),0, notificationIntent,

PendingIntent.FLAG_CANCEL_CURRENT);

Resources res = getApplicationContext().getResources();

Notification.Builder builder = new Notification.Builder(getApplicationContext());

builder.setContentIntent(contentIntent)

. setSmallIcon(R.drawable.ic_launcher)

. setLargeIcon(BitmapFactory.decodeResource(res, messages.media))

. setTicker("Got a new message")

. setWhen(System.currentTimeMillis())

. setAutoCancel(true)

. setContentTitle(message.titile)

. setContentText(message.text);

Notification notification = builder.getNotification();

mNotificationManager.notify(notifyID, notification);

notifyID++;

}

}

更新

为了了解更多的信息,我添加了图片

当我发送通知时 -pic1 - icon 显示了我有多少

29eca10141c6ca3338ebba1a194e8e21.png

当我打开状态栏时,-pic2会显示所有通知

5dbc729791e686642df80ec2125e038f.png

这样做是有可能的?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值