我正在尝试让这个插件工作,但它对我不起作用。
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");
});
我做错了什么?
答案 0 :(得分:0)
经过一些调整后立即开始工作;
PhoneGap.addConstructor(function () {
PhoneGap.addPlugin("SystemNotification", new SystemNotification());
PluginManager.addService("SystemNotification", "com.phonegap.plugins.SystemNotification.SystemNotification");
window.plugins.SystemNotification.touch();
});
window.plugins.SystemNotification.onBackground();
window.plugins.SystemNotification.createStatusBarNotification('', '', '');