Can service-worker stop push notification sent by GCM api? - push-notification

In my current architecture, I submit push notifications using the GCM API.
This triggers a 'push' event in the service worker. The service worker then adds some data to the notification.
If the service worker is unable to add the data, due to some error, I am getting a blank notification.
Can service workers avoid showing notifications sent by GCM?

From the Push Notifications guide at Google Developers:
You must pass a {userVisibleOnly: true} argument to the subscribe()
method. This tells the browser that a notification will always be
shown when a push message is received. Currently it’s mandatory to
show a notification.
The upshot is that if you don't show something in response to a push (after promising the browser that you will), the browser (Chrome, at any rate) will just show something for you. However, it seems likely that this will change at some point.

It seems that upon the error condition you hit you are still showing your own notification anyway and since you could not fill it up it shows up blank.
Your best option is to fallback to some generic text. You can risk not showing it but after a few times chrome will start showing its own notification (after all you "promised" you would be showing one by saying {userVisibleOnly: true})
The best sequence of steps I can think of looking at the chrome code is:
1) Try to show the notification you want to show
2) If that fails for whatever reason check if you are in the foreground or if one of your notifications is already showing. If so do nothing
3) Else you need to show a notification, otherwise it's likely that chrome will show it for you and risking it is probably not worth it. Just add some generic text and show it.

Related

Google Calendar API: attendees response status not updating when user respond to invite email

Good day all
I'm busy integrating the calendar API into my C# system and ran into a bit of a headache.
When I create an event, and I add attendees, they get their emails with the invite.
My issue comes, when they accept (or reject) the meeting, their responses are not captured.
In my event their response status always remain: NeedsAction
I have tested this directly via the Calendar API (https://developers.google.com/calendar/api/v3/reference/events/get) and I can get the event, I can see the attendees, yet their responseStatus does not change.
Does anyone have any idea what the problem could be?
Kind regards
I believe I found the answer to the issue.
Basically what it comes down to, the person that accepts the invitation, needs to have a google calendar associated with their account.
What happened was I was sending the invite requests to my work email (that did not have an google account or calendar account associated with it).
I tested it again to my personal gmail, and viola! There it works perfectly.
Here is an image illustrating how the invite would appear in Microsoft Mail. https://i.stack.imgur.com/tKPgN.jpg
If you accept there at the top option, the event would be added to your calendar, and potentially an email might be sent to the creator, but it does not get updated on the creator's google calendar. If you try to accept at the bottom, then you get a google error 400 page. This is what hinted me to what the issue was.

Google Analytics User-ID-status showing as "Unassigned"

I have this scenario
I enabled User-ID feature and Session Unification feature.
On the frontend when someone Signup I set their newly created UserId and I trigger custom event, that says that someone signed up.
Then I trigger another custom event from the backend that say that user becomes a friend with someone (need to do this fro the backend) and I'm using Measurement Protocol for this hitting this endpoint when this happens https://www.google-analytics.com/collect?v=1&t=event&tid=trackingId&uid=uid&ec=eventCategory&ea=eventAction&el=eventLabel
Now the problem that I have is that I did a small test, where I registered 2 users, and for one I become a friend with someone just to see if that event triggers too
Inisde the Realtime everything works as expected, but when the reports show up the next day I got 1 user with status Unassigned
Any Ideas what can break this flow and how this can happen? I thought If data in realtime is ok that it will be on reports too, Thanks!
Miss & before ea parameter. This can make issue because event action will not recognized and it is a required parameter.
EDIT
if you have done the tests too far apart (30 minutes) you can generate some inconsistencies due to the session, considering that you send an event.
Note: real-time data is generally unreliable.

Youtube API - is there a way to get real-time information about youtube channels like new video being uploaded?

I am trying to build an application that does something every time a new video is uploaded to one or more channels.
My search lead me to the Youtube Data API V3. This is a push notification service that sends information every time a channel that you are subscribed to makes one of the following changes:
1. new video upload, 2. change in title, and 3. change in the video description.
I implemented this in python and I subscribed to receive updates on my channel. I was able to see that the subscription was successful using the pubshub/ websub tool . However, when changes were made to the videos on the channel I was subscribed to, I did not receive any push notifications.
some said that there's a huge delay ( it should not be because youtube claims it's near real-time), but then I saw the issue tracker page for this feature which basically says that the feature is broken.
So, I wanted to know if there is any other mechanism that I can try to do this? or is there someone who has tried this, and it's working?

Actions Google Simulator not working

5I'm creating a google actions for Google Home, i'm using dialogflow and firebase functions and database to create the all thing.
So far everything was working good together but yesterday an error occured that i dont understand.
When i want to test my agent on the Simulator section of Google Actions, the agent is not responding even if in the logs i can see that the response is actually received by the simulator as shown here
And it answer this in the simulator
The response is empty and i have this simple error in the Debug section
It worked perfectly before but i may have change one thing that crashed everything and i can't find it.
EDIT
As recommended by #Prisoner, i've checked the History to find this
So i checked the logs and i got this (after Dialogflow Request and Dialogflow fulfillment request who were looking good)
It seems that the Dialogflow fulfillement response is having problem with URL ???
EDIT2
My URL fulfillment (firebase functions) was wrong, now that i have changed it, the log in my History seems ok :
But i'm always getting the same error on the Simulator.
Your logs show that your fulfillment is not deployed correctly and the URL is pointing to a HTML 404 page. This will cause your app to stop responding.
You may be running into the recent "first TTS is not spoken" bug in the simulator. I suggest changing your surface to speaker instead of phone. You can read more about this here.

Phonegap Push Notification redirect to specific page in the application when clicking

Using Phonegap Push Notifications Plugin to build a mobile application for IOS and Android, how proceed to let the notification received redirect or forward to a specific page in the application when the user clicked it? i.e. when receiving the notification, the user must open it to see it, we need to forward the application to a specific page, like notifications.html?id=USER_ID?
Is that any way to send the parameter USER_ID with the message pushed , The issue could be resolved in this case...
Thank you for your suggestions...
When you sent a push notification from your server includes an extra value name id.
When the notification is received then save the value of this "extra value" id using localStorage.setItem.
then inside onresume event reads the value of this id using localStorage.getItem, and according the value open the respective page using $.mobile.changePage( ...);
for detail check this :
https://github.com/phonegap-build/PushPlugin/issues/213

Resources