在Android的状态栏多个推送通知present当被Seconde系列他人感动消失 [英] Multiple push notification present in the status bar in android when the seconde is touched others vanish

查看:143
本文介绍了在Android的状态栏多个推送通知present当被Seconde系列他人感动消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在科尔多瓦的Andr​​oid应用程序通知GCM工作。
当应用程序在后台运行并通知来
它显示在该装置的状态栏。
当两个以上的通知显示在该状态栏,我第一次通知(在状态栏中显示的)挖掘,应用程序打开并显示该通知消息,当我在第二次通知所有剩余的通知自来水(中状态栏)消失。
在这种fonction,当我通知自来水,部分(!e.foreground)运行。

I work with Notification GCM in cordova android apps. when the application is running in background and a notification came it is displayed in the status bar of the device. when more than two notifications are displayed in this status bar, I tap on first notification (displayed in the status bar), the application opens and it displays the notification message, when I tap on the second notification all of the remaining notifications(in the status bar) vanish. In this fonction, when I tap on the notification, the part (! e.foreground) runs.

function onNotificationGCM(e) {

  switch( e.event )
   {
    case 'message':


        if (e.foreground)
        {   
            // playAudio('http://oringz.com/oringz-uploads/sounds-1068-the-calling.mp3');
            navigator.notification.beep(1);
            msgNotification(e.payload.message);
            $("#toastContainer").dxToast('instance').show();
            var notif={message:e.payload.message};
            popovernotifListe.push(notif);
            nbrnotif(nbrnotif()+1);

        }
        else if (!e.foreground)
        {

             if (e.coldstart) {
                    console.log("App was not running and user clicked on notification");
            } else {
                console.log("App was running and user clicked on notification");
            }
            msgNotification(e.payload.message);
            $("#toastContainer").dxToast('instance').show();
            nbrnotif(nbrnotif()+1);
            var notif={message:e.payload.message};
            popovernotifListe.push(notif);

        }
        break;

        case 'error':
          console.log('GCM error = '+e.msg);
        break;

        default:
          console.log('An unknown GCM event has occurred');
        break;
}

}

推荐答案

如果通知ID不会从你的服务器发送,每个通知与一个ID创建 0

If the notification ID is not sent from your server, each notification is created with an ID 0.

要解决这个问题,你必须设置通知ID 为您创建的每个通知。您可以通过从服务器发送一个参数 notID ,每一个通知,该通知将被用来<一个设置通知ID href=\"https://github.com/phonegap-build/PushPlugin/blob/master/src/android/com/plugin/gcm/GCMIntentService.java#L126\"相对=nofollow>创建一个通知。

To fix this problem, you will have to set the notification ID for each notification you create. You can set the notification ID by sending a parameter notID from the server, with each notification, which will be used to create a notification.

这篇关于在Android的状态栏多个推送通知present当被Seconde系列他人感动消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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