【发布时间】:2011-04-27 19:19:15
【问题描述】:
我正在尝试让这个插件工作,但它对我不起作用。
https://github.com/saileshmittal/phonegap-system-notification-plugin
我认为我在 Javascript 文件中调用插件时做错了。这是我目前所拥有的;
var not_title = 'MELVIN';
var not_text = 'Zou dit werken?';
var not_tText = 'of toch niet?';
navigator.systemNotification.onBackground();
//navigator.systemNotification.onForeground();
navigator.systemNotification.createStatusBarNotification(not_title, not_text, not_tText);
//navigator.systemNotification.updateNotification(not_title, not_text, 1);
这是 SystemNotification.js 底部的内容;
PhoneGap.addConstructor(function () {
if (typeof(navigator.systemNotification) == "undefined") {
navigator.systemNotification = new SystemNotification();
navigator.systemNotification.touch(); //this ensures that the plugin is added when phonegap kicks off
}
//PhoneGap.addPlugin("systemNotification", new systemNotification());
PluginManager.addService("systemNotification", "com.SystemNotification.SystemNotification");
});
我做错了什么?
【问题讨论】:
-
由于您明确调用“onBackground”,我假设您也想在应用程序处于前台时获取系统通知。您能否将控制台日志放入 create...Notification 方法并查看它是否被调用?还要确保你按照自述文件所说的去做。