Push Notification not working
-
Maybe you @Krille
-
@beli3ver Not much of experience with C, but is that correct: "if ( req.readyState === XMLHttpRequest.DONE )"? Shouldn't be "==" ?
-
@C0n57an71n as the code snippet posted is JavaScript, "===" is correct.
-
You did not set the token to the actual token and you just put the string
TOKEN
.
I compare to my Pesbuk code and I think that's the main difference.You can check here.
https://github.com/kugiigi/pesbuk-app/blob/89c75d28330c956e2aada21bc5cbbe9b5cf2016a/pesbuk/Main.qml -
Ok I wrote TOKEN to not post my real token.
But I think I found my mistake. I guess that the code snippet must be in the app as well?
Currently I'm running it on the server and thought that this way I send notifications to the client, so I guess that was my mistake
-
@kugiigi maybe you can help me.
I am really stuck.
I have integrated Push Notifications as it is written in the Wiki. I also have a function that sends the token to my server, I get that too.Now the question, the function above is used to send a notification from my server to the Ubuntu server or does this code have to be called into the app because it gets called when the Ubuntu server sends a notification to the app?
-
@beli3ver Oh I see, I didn't think of that
My app executes this code because it's actually just a workaround for having push notification in the webapp. I have no other experience with push notification but I think the code should actually be executed in the server but the token has to be coming from the device that should receive the notification.
-
Just to provide some reference links.
The wiki you mentionned is probably the official documentation:
http://docs.ubports.com/en/latest/appdev/guides/pushnotifications.htmlAnd have you checked the example app "PushClient" ?
https://github.com/ChristianPauly/pushclient -
@kugiigi said in Push Notification not working:
My app executes this code because it's actually just a workaround for having push notification in the webapp.
Oh, could you explain a bit how that works? It is taking the web notifications and translating them to UT push? I have been scratching my head how to implement push notifications with a web-app.
-
@poVoq No not really, it's a pure hacky way. I simply injected JS codes to check the notification flags in the webpage so it needed to disable app suspension. Actually, it seems that it stopped working. Not sure if it's Facebook's fault or UT's.
-
@beli3ver your notification system works well