适用于Android的PhoneGap cordova插件

时间:2013-06-26 20:56:49

标签: cordova

我正在使用这个例子 https://github.com/phonegap/phonegap-plugins/tree/master/Android/StatusBarNotification

但我不能传递“标签”。

例子说.....

window.plugins.statusBarNotification.notify("Put your title here", "Put your message here");

我应该在哪里更改代码以使其接受“tag”作为参数?

我想做

window.plugins.statusBarNotification.notify("11", "Put your title here", "Put your message here");

1 个答案:

答案 0 :(得分:1)

将statusbarnotification.js中的NotificationMessenger.prototype.notify()更改为:

/**
 * @param tag Tag of the notification
 * @param title Title of the notification
 * @param body Body of the notification
 * @deprecated Use the W3C standard window.Notification API instead.
 */
NotificationMessenger.prototype.notify = function(tag, title, body, flag) {
    if (window.Notification) {
        this.activeNotification = new window.Notification(title, {
            body: body,
            flag: flag,
            tag: tag
        });
    }
}

然后你可以打电话:

window.plugins.statusBarNotification.notify("11", "Put your title here", "Put your message here");