如何处理在使用的PhoneGap Android的GCM多个推送通知 [英] How to handle multiple push notifications in android using GCM on phonegap

查看:251
本文介绍了如何处理在使用的PhoneGap Android的GCM多个推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个推送通知的到来,如果用户不在看到通知。他得到了另一个通知previsous是越来越被新更新。
但它不应该与最新的一次更新。我们需要显示每个通知分别是,可以使用GCM?

When a push notifications is arrived, if user is not available to see the notification. he got another notification the previsous is getting updated with the new one. But it should not update with latest one. we need to display each notification separately is that possible using GCM?

我已经使用PhoneGap的开发应用

I have used Phonegap to develop the application

推荐答案

好吧,如果你看看<一实施href=\"https://github.com/phonegap-build/PushPlugin/blob/master/src/android/com/plugin/gcm/GCMIntentService.java\"相对=nofollow> PushPlugin ,你会看到,他们使用一个恒定的通知ID:

Well, if you look at the implementation of PushPlugin, you'll see that they use a constant notification ID:

public static final int NOTIFICATION_ID = 237;
...
mNotificationManager.notify((String) appName, NOTIFICATION_ID, mBuilder.build());

这将导致每一个新通知覆盖现有之一。这就是为什么只显示最后的通知。

This would cause every new notification to overwrite the existing one. That's why only the last notification is displayed.

如果你想改变的行为,你必须改变code使用一个唯一的ID通知每个通知。

If you want to change the behavior, you have to change the code to use a unique notification ID for each notification.

这篇关于如何处理在使用的PhoneGap Android的GCM多个推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆