katzer / cordova-plugin-local-notifications

Cordova Local-Notification Plugin
Apache License 2.0
2.56k stars 1.75k forks source link

how the plugin works #86

Closed Mrkhagol closed 10 years ago

Mrkhagol commented 10 years ago

Hey there..your plugin is great and thanks for sharing.

But would you happen to have a demo example of how it all fits together. ??

katzer commented 10 years ago

Any suggestions or ideas?

Mrkhagol commented 10 years ago

what i am doing is setting up a reminder which gives out notification and then I select it and it takes me to the app screen where I am placing this feature. By the way this is android 4.4.2..I have even included device that you have in dependencies section..anyways..So when the app opens up I see the alert I place in the ontrigger function. Now, the same thing doesn't take place in ios 7..the app opens up but I don't the alert javascript message that is placed in ontrigger function..

window.plugin.notification.local.add({ id: 1, // is converted to a string title: 'Reminder test', message: 'this is your reminder', repeat: 'daily', date: _60_seconds_from_now });

window.plugin.notification.local.ontrigger = function (id, state, json) { alert("Hello"); };

so that's why I was asking for demo to see if you had set up anything similar and maybe i could find what I missed..

katzer commented 10 years ago

I think the behavior is related to the mobile OS and how apps works while they are in background.

On Android there is not so much difference between foreground and background state. But on iOS the app will be suspended while in backgrounds. Thats why the plugin does not receive the outrigger event.

You can install https://github.com/katzer/cordova-plugin-background-mode as a solution.

katzer commented 10 years ago

Sounds similar to #84

Mrkhagol commented 10 years ago

so I put this in my config.xml

image

and I get this

image

katzer commented 10 years ago

Yes, the plugin is not available by PGB.

katzer commented 10 years ago

I have submitted the plugin. Hope it can help you.