簡體   English   中英

Phonegap系統通知插件

[英]Phonegap system notification plugin

我試圖讓這個插件工作,但它對我不起作用。

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");

});

我究竟做錯了什么?

經過一些調整現在可以工作了;

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('', '', '');

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM