WebにてServiceWorkerを使ったpush notificationを、以下のサイトを参考に以下のように実装しております。
http://deanhume.com/home/blogpost/push-notifications-on-the-web---google-chrome/10128
javascript
1 navigator.serviceWorker.register('serviceWorker.js').then(function(registration) { 2 // Registration was successful 3 console.log('ServiceWorker registration successful with scope: ', registration.scope); 4 registration.pushManager.subscribe().then(function(subscription){ 5 isPushEnabled = true; 6 console.log("subscription.subscriptionId: ", subscription.subscriptionId); 7 console.log("subscription.endpoint: ", subscription.endpoint); 8 9 // TODO: Send the subscription subscription.endpoint 10 // to your server and save it to send a push message 11 // at a later date 12 return sendSubscriptionToServer(subscription); 13 }); 14 }).catch(function(err) { 15 // registration failed :( 16 console.log('ServiceWorker registration failed: ', err); 17 });
GCMにて「Google Cloud Messaging for Android」、Server Keyにて認証情報の取得も済まし、manifestファイルに"gcm_sender_id"とプロジェクト番号を設定したのですが、以下のエラーが返っております。
Uncaught (in promise) DOMException: Registration failed - permission denied
アドバスなど頂けませんでしょうか。
よろしくお願いいたします
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。