0

I am trying to use local notification on Phonegap. I use phonegap-plugin-local-notification 1.0.1 "phonegap-plugin-local-notification" and following code to test it (on device ready state):

        if ("Notification" in window) {
        Notification.requestPermission(function (permission) {
            // If the user accepts, let's create a notification
            if (permission === 'granted') {
                var notification = new Notification("My title", {
                    tag: 'message1',
                    body: "My body"
                });
                notification.onshow  = function() { console.log('show'); };
                notification.onclose = function() { console.log('close'); };
                notification.onclick = function() { console.log('click'); };
            }
        });
    }

What I got is Notification is NOT in window. Does anybody know how to use this plugin or am I supposed to add anything to config.xml.

Or is there any other solution to send local notification

Sam
  • 1,424
  • 13
  • 28

2 Answers2

0

I used following plugin: https://github.com/katzer/cordova-plugin-local-notifications

While I tested the plugin over Phonegap application it did not work but after building the android apk it works quite fine.

Sam
  • 1,424
  • 13
  • 28
0

Try with this plugin.Working fine for both android and Ios.

<plugin spec=" https://github.com/acianti/cordova-plugin-local-notifications.git" />
Maheshvirus
  • 6,749
  • 2
  • 38
  • 40