Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On click event not triggered on iOS #1082

Closed
Piranya opened this issue Aug 25, 2016 · 8 comments
Closed

On click event not triggered on iOS #1082

Piranya opened this issue Aug 25, 2016 · 8 comments

Comments

@Piranya
Copy link

Piranya commented Aug 25, 2016

Hi,
On iOS Notifications are displayed correctly, but when I click on it it just opens an app and not triggers associated event. On Android all is working fine.

@nowen-a10
Copy link

Same here with iOS.

@plantastika
Copy link

anyone has a fix to this issue?

@plantastika
Copy link

same problem in iOS, here the code

cordova.plugins.notification.local.schedule({
id: 123,
text: 'This is my notification',
sound: sound,
badge: 1
});

and the click...

cordova.plugins.notification.local.on("click", function (notification) {
alert("user clicked on notification");
});

try this too but does not work either

cordova.plugins.notification.local.on("click", function (notification) {
if (notification.id == 123) {
alert("user clicked on notification");
}
});

@nowen-a10
Copy link

nowen-a10 commented Sep 9, 2016

I'm on Phonegap Build and I got this to work:

var localnotificationsetup = false;

function setupLocalNotifications()
{
if(!localnotificationsetup)
{
window.plugin.notification.local.on("trigger", function (notification, state) { alert('trigger ' + notification.id); }, this);
window.plugin.notification.local.on("click", function (notification, state) { alert('onclick' + notification.id); }, this);
localnotificationsetup = true;
}
}

This code works for me if I call setupLocalNotifications() when I create a new schedule window.plugin.notification.local.schedule, but doesn't seem to work if I do it at "deviceready". Specifically what made it work was adding the scope of "this" on the local.on call.

@rwillett
Copy link
Collaborator

Is this still an issue? if so update with template in #1188.

@rwillett
Copy link
Collaborator

Closed as no update from Original Poster

@japostigo-KMM
Copy link

@rwillett Although the original poster didn't update the issue, I can confirm that the problem at present still persist.

@dielfilho-zz
Copy link

Any update on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants