LoginSignup
1
0

More than 1 year has passed since last update.

Notificationメモ

Posted at

トラブルシューティング

new Notificationは、WebWorkerで機能する

PC/Chromeでなぜか動いてしまうため、誤認しやすい。

環境 稼働
PC/Chrome 実行できる。
Android/Chrome 実行できない。
WebWorker 実行できる。

doc

Frontでの呼び出し方

navigator.serviceWorker.ready.then(function (registration) {
  return registration.showNotification("Title", {
    body: "body"
  })
}).catch(e => {
  // error処理
})

Service Workerからの呼び出し方

self.registration.showNotification(notificationTitle, notificationOptions)
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0