web-push

FCM: Cannot click notification

有些话、适合烂在心里 提交于 2019-12-04 19:25:36
问题 I'm using the recently release FCM messaging support for push notifications on the chrome. When my app is in the background, I get the notification but nothing happens when I click the notification. How to I specify the URL which should open when the user clicks the notification? (I understand how its done using the pure service worker concept using the notificationclick event, I want to know how to do that using FCM messaging.) messaging.setBackgroundMessageHandler(function(payload) { var

PushManager subscription promise never fulfill nor reject

人走茶凉 提交于 2019-12-03 13:57:28
I am currently facing an issue with some Chrome (Chromium) version where the PushManager.subscribe promise from a ServiceWorker stays in a pending state . The code itself is pretty simple : return serviceWorkerRegistration.pushManager.subscribe({ userVisibleOnly: true }); I have a valid and accessible JSON manifest , providing the GCM Sender ID . I also tried different implementations, as described in this post , but the result is still the same. The subscription part works well with every 47+ version, the issue appears with older releases. (I'm using Chromium continuous builds to test the

How to add analytics for Push notifications

♀尐吖头ヾ 提交于 2019-12-03 13:48:16
问题 I'm working on progressive web app, and I want to implement analytics for Push notifications. How can I add analytics for push notifications so that I'll be able to track and record how many people clicked on notification and how many people close that notification without clicking on it. 回答1: I've written a small chunk of code to use Google analytics for analytics and it works fairly well. Dumped notes here: https://gauntface.com/blog/2016/05/01/push-debugging-analytics The way I've done

GCM registration id in Service Worker in Push Notification for chrome

百般思念 提交于 2019-12-03 12:42:50
问题 I am able to send push notification and in service worker i am making a service call i just to want to send GCM registration id with that service call. How to get registration id or subscription id in service worker here is my code self.addEventListener('push', function(event) { console.log('Received a push message from local', event); var title = 'My title file. Testing on'; var body = 'New Push Message.'; var icon = 'refresh_blueicon.png'; var tag = 'my-push-tag'; event.waitUntil( // Here i

FCM: Cannot click notification

别等时光非礼了梦想. 提交于 2019-12-03 12:23:12
I'm using the recently release FCM messaging support for push notifications on the chrome. When my app is in the background, I get the notification but nothing happens when I click the notification. How to I specify the URL which should open when the user clicks the notification? (I understand how its done using the pure service worker concept using the notificationclick event, I want to know how to do that using FCM messaging .) messaging.setBackgroundMessageHandler(function(payload) { var data = payload || {}; var shinyData = decoder.run(data); console.log('[firebase-messaging-sw.js]

OneSignal subscribe user through web page using web-push-sdk

夙愿已清 提交于 2019-12-03 05:21:45
问题 Is there a way in one signal web-push-sdk to add user manually and unsubscribe? I tried this in my subscribeOneSignal() function but nothing happening. OneSignal.push(function() { OneSignal.registerForPushNotifications(); }); I have simple html page where I have two buttons one "Subscribe" and other is "Unsubscribe", now when user click on Subscribe button he should add at one signal and when he clicked on "Unsubscribe" button he shouldn't receive the notifications. <!DOCTYPE html> <html>

How to add analytics for Push notifications

偶尔善良 提交于 2019-12-03 03:41:11
I'm working on progressive web app, and I want to implement analytics for Push notifications. How can I add analytics for push notifications so that I'll be able to track and record how many people clicked on notification and how many people close that notification without clicking on it. Matt Gaunt I've written a small chunk of code to use Google analytics for analytics and it works fairly well. Dumped notes here: https://gauntface.com/blog/2016/05/01/push-debugging-analytics The way I've done this is the post mentioned above: In the service worker I import a javascript file that does the

PushPad: Subscribe is removed after site refresh

醉酒当歌 提交于 2019-12-02 03:36:43
问题 I've integrated PushPad and managed to get it working for static Push's. Now I wanted to combine it with some PHP and Javascript-Functions to make it dynamic. Here is my code: <script> (function(p,u,s,h,x){p.pushpad=p.pushpad||function(){(p.pushpad.q=p.pushpad.q||[]).push(arguments)};h=u.getElementsByTagName('head')[0];x=u.createElement('script');x.async=1;x.src=s;h.appendChild(x);})(window,document,'https://pushpad.xyz/pushpad.js'); //Install Pushpad pushpad('init', myprojectnumber); alert(

PushPad: Subscribe is removed after site refresh

喜你入骨 提交于 2019-12-02 02:31:39
I've integrated PushPad and managed to get it working for static Push's. Now I wanted to combine it with some PHP and Javascript-Functions to make it dynamic. Here is my code: <script> (function(p,u,s,h,x){p.pushpad=p.pushpad||function(){(p.pushpad.q=p.pushpad.q||[]).push(arguments)};h=u.getElementsByTagName('head')[0];x=u.createElement('script');x.async=1;x.src=s;h.appendChild(x);})(window,document,'https://pushpad.xyz/pushpad.js'); //Install Pushpad pushpad('init', myprojectnumber); alert("Pushpad initialised"); //Check subscribe-status pushpad('status', function (isSubscribed, tags){ //User

How to get registered into GCM topics from javascript (for Chrome)

喜夏-厌秋 提交于 2019-12-01 06:06:05
Here is a nice documentation on how to implement Google Cloud Messaging (GCM) in Chrome. But I do not found any reference here or anywhere how to subscribe to a topic using javascript (for Chrome). Here I have found a reference how to do the task for Android: https://developers.google.com/cloud-messaging/topic-messaging#subscribe-to-a-topic Java code(Android) for subscribe to a topic in GCM: private void subscribeTopics(String token) throws IOException { GcmPubSub pubSub = GcmPubSub.getInstance(this); for (String topic : TOPICS) { pubSub.subscribe(token, "/topics/" + topic, null); } } WHAT I