如何处理不同GCM点击的通知 [英] how to handle different GCM notifications clicks

查看:207
本文介绍了如何处理不同GCM点击的通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用GCM推送通知到我的应用程序。一切安好。

当我得到通知,当我点击我的通知可以移动其他activity.I想过去网址链接到另一个activity.but,如何处理点击多个通知。

下面,当我得到通知5,然后点击我移动到其他活动的任何通知但我传递的环节是第一个通知的URL说。我使用不同的通知ID

  NotificationManager notificationManager =(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(X
                    / *通知ID * /
                ,notificationBuilder.build());


解决方案

创建的PendingIntent时使用PendingIntent.FLAG_UPDATE_CURRENT。

又路过意图的PendingIntent其设置不同的行动之前,每次。例如: -

  intent.setAction(Long.toString(System.currentTimeMillis的()));

I have used GCM Push Notifications into my app. Everything is fine.

When i get notification and when i click notification I can move other activity.I am passing url link to another activity.but,How to handle click on multiple notifications.

Here say when I get 5 notifications and click on any notification I am moving to other activity but the link which I am passing is the first notification url. I am using different notification id

 NotificationManager notificationManager = 

(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);

 notificationManager.notify(x
                    /*ID of notification */
                , notificationBuilder.build());

解决方案

use PendingIntent.FLAG_UPDATE_CURRENT when creating PendingIntent.

Also before passing intent to PendingIntent set its action different everytime. e.g.:-

intent.setAction(Long.toString(System.currentTimeMillis()));

这篇关于如何处理不同GCM点击的通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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