简体   繁体   中英

Phonegap system notification plugin

I'm trying to get this plugin to work but it wont work for me.

https://github.com/saileshmittal/phonegap-system-notification-plugin

I think im doing something wrong with calling the plugin in the Javascript file. This is what i have so far;

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

this is what is have in SystemNotification.js in the bottom of it;

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

});

What am I doing wrong?

Got it working now after some adjustments;

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM