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
addListenerForNotificationOpened callback not working #188
Comments
Hey @moklick, Do you by any chance have a publicly accessible site URL I could test this out on? Otherwise, can you let us know if:
I haven't looked into this yet, but it might be related to #185 which is a bug in our SDK. |
Hey @jasonpang, thanks for your fast response. We are only using HTTPS. I am testing this with localhost and |
Any update on this? |
Hey @TroyCoombs @moklick, Based on @moklick's description, what's happening here is that This explains why @moklick mentioned:
@moklick, sorry you went through the trouble of testing all that. For now, to have your callback fired whenever a notification is clicked not just once, but every time, please call |
Thanks @jasonpang, works great now! |
thanks for the update @jasonpang |
Hey @jasonpang @moklick I am facing same issue and I never reach to callback Not even once but whenever I refresh the page only then I am using following code: I have created test app, I can give you credentials. var OneSignal = window.OneSignal || [];
OneSignal.push(["init", {
appId: "*****",
subdomainName: '****',
autoRegister: true, /* Set to true to automatically prompt visitors */
httpPermissionRequest: {
enable: true,
},
notifyButton: {
enable: true, /* Set to false to hide */
},
notificationClickHandlerMatch: 'origin',
notificationClickHandlerAction: 'focus',
}]);
function notifListen() {
OneSignal.push(['addListenerForNotificationOpened', notificationData => {
console.log('Received NotificationOpened:', notificationData);
notifListen();
}]);
}
notifListen(); I am sending only header and message while pushing the notification. Did I miss anything? Let me know if you need appId and REST API key. |
Hey there, I wasn't able to reproduce this issue. Make sure the URL you're sending matches the same origin as your site (this means the URL must match the beginning protocol of your site like http:// or https://). Message us at support@onesignal.com with a test page on your site and the URL you're using for the notification if you're still having trouble. |
Hi @jasonpang, |
Hi @rluckez did you find a solution, I have the same issue here. |
@jasonpang Can we get a working code example for triggering the click event right away? I've tried to do what was suggested, but it's really unclear what your solution looks like. It might also be helpful to add this solution to the docs - I ended up here because I need to generate dynamic url strings for utm params, and |
Hey @rossPatton, can you clarify what you're trying to do? Generating a dynamic UTM param shouldn't be related to |
CAN ANYONE GIVE ME THE SOLUTION I FACED THIS PROBLEM BUT I CAN'T FIND THE FIGHT SOL ...PLEASE HELP ME !!! I FACE THE TERMINATION |
Having this issue too, any solution? |
Any updates? How can we fix this problem. We get callback just once if we close the browser. |
use HTTPS in your domain, don't use HTTP. that's work. :D |
Hello,
I am encountering problems with the
addListenerForNotificationOpened
callback.When I am enabling subscriptions it works whether a tab with my app origin is open or not. But it's only working once. After I clicked a notification it's only working when I don't have open tabs with the origin.
The tab gets focused but the callback is not triggered. When I then close the tab and open it again I receive the callback.
This is how I subscribe to the
addListenerForNotificationOpened
event:I am using chrome 52.0.2743.82 and firefox 48.0.2 on Linux. In both browsers I have the same problems. My workaround for now is that I listen to the messages and check if it's type
notification.clicked
:Thanks for your help.
The text was updated successfully, but these errors were encountered: