【发布时间】:2015-01-14 12:49:14
【问题描述】:
我在cordovausing this push plugin中成功实现了推送通知。
一切正常,但如果收到多个通知,则只有最新通知可用。我已经提到了this answer,但它使用的是旧插件。
这是我从答案中尝试的代码。
int notId=0;
try {
notId = Integer.parseInt(extras.getString("notId"));
}
catch(NumberFormatException e) {
Log.e(TAG, "Number format exception - Error parsing Notification ID: " + e.getMessage());
}
catch(Exception e) {
Log.e(TAG, "Number format exception - Error parsing Notification ID" + e.getMessage());
}
notId++;
mNotificationManager.notify((String) appName, notId, mBuilder.build());
【问题讨论】:
-
notId 始终等于 0。因此它不会显示很多通知。将 notId 声明为 globle,它将起作用。
-
你的意思是声明为全局类变量
-
在 createNotification 函数之外定义 notId。
-
我试过但没用
-
你能展示一个示例代码吗?
标签: android cordova push-notification ionic-framework