android - 接收不同标准的多个推送通知并根据该标准更新通知

标签 android notifications push-notification google-cloud-messaging

我已经合并了 GCM 通知,但它会覆盖现有的,然后根据

中给出的建议

this link我使用并得到了它,但它正在更新为多个通知,需要像这个图像一样实现 -

enter image description here

在这里我无法在多行中实现这种类型。我正在尝试 BigNotify不使用样式和扩展,但我需要按照 Summarize notification guide 中声明的那样堆叠通知

至少我正在尝试从 3 次聊天中获得 5 条消息作为通知的总结,是否有任何解决方法?

最佳答案

我得到了答案,试过this

`

public static void pushNotification(Activity currentActivity, String title, String content[]){

    NotificationManager nm = (NotificationManager) currentActivity.getSystemService(Context.NOTIFICATION_SERVICE);

    Intent resultIntent = new Intent(currentActivity.getBaseContext(), FileSharingActivity.class);

    TaskStackBuilder stackBuilder = TaskStackBuilder.create(currentActivity);
    stackBuilder.addParentStack(FileSharingActivity.class);
    stackBuilder.addNextIntent(resultIntent);
    PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0,PendingIntent.FLAG_UPDATE_CURRENT);


    nm.notify(nextId++, new Notification.InboxStyle(new Notification.Builder(currentActivity.getBaseContext())
            .setTicker("Ticker")
            .setSmallIcon(R.drawable.ic_launcher)
            .setWhen(System.currentTimeMillis())
            .setContentTitle("Content title")
            .setContentText("Content text")
            .setNumber(4)
            .setContentIntent(resultPendingIntent))
            .addLine("First Message")
            .addLine("Second Message")
            .addLine("Third Message")
            .addLine("Fourth Message")
            .setBigContentTitle("Here Your Messages")
            .setSummaryText("+3 more")
            .build());
}

`

关于android - 接收不同标准的多个推送通知并根据该标准更新通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33781263/

相关文章:

IOS报亭后台故障排除

Android使用处理程序将数据从TCP线程发送到不同的 Activity

java - 从文件或图库中查找并拍摄最后一张照片。 Android Studio(Java)

iphone - 苹果推送通知在生产中不起作用

android - 如何为 FirebaseMessagingService 实现 onDeletedMessages()?

android - 访问铃声模式在服务内部不起作用

google-chrome - 从封闭的网络应用程序在 Chrome 或 Firefox 中发送桌面通知?

android - 以编程方式调整布局大小(作为动画)

Android 绘图 View 非常慢

actionscript-3 - Adobe Air (AS3) 可以直接使用 socket.io 吗?