Title: Support setting Application Badge from Service workers · Issue #53920 · angular/angular · GitHub
Open Graph Title: Support setting Application Badge from Service workers · Issue #53920 · angular/angular
X Title: Support setting Application Badge from Service workers · Issue #53920 · angular/angular
Description: Which @angular/* package(s) are relevant/related to the feature request? service-worker Description Currently you can use Push notification for displaying notification messages. But it is not possible to change application badge from pus...
Open Graph Description: Which @angular/* package(s) are relevant/related to the feature request? service-worker Description Currently you can use Push notification for displaying notification messages. But it is not possi...
X Description: Which @angular/* package(s) are relevant/related to the feature request? service-worker Description Currently you can use Push notification for displaying notification messages. But it is not possi...
Opengraph URL: https://github.com/angular/angular/issues/53920
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support setting Application Badge from Service workers","articleBody":"### Which @angular/* package(s) are relevant/related to the feature request?\n\nservice-worker\n\n### Description\n\nCurrently you can use Push notification for displaying notification messages. But it is not possible to change application badge from push notification when application is not started. \r\nYou can use setAppBadge from SwPush.messages, but this only works when application is already running. \r\n\n\n### Proposed solution\n\nSupport setting application badge natively in ngsw-worker.js. New push payload would look something like this:\r\n```typescript\r\n{\r\n \"notification\": {\r\n \"actions\": NotificationAction[],\r\n ....\r\n },\r\n \"appBadge\": number | undefined\r\n}\r\n```\r\nIf appBadge property is not set nothing will happened, but if it is set, then inside \"push\" event, self.navigator.setAppBadge should be called with value of \"appBadge\". Setting \"appBadge\" to 0, will clear badge.\r\n\n\n### Alternatives considered\n\nNow the only way to change application badge when application is offline is to use custom service worker to handle \"push\" event and then import ngsw-worker.js. But I'm not sure that even this will work on WebKit, because as stated in https://webkit.org/blog/14112/badging-for-home-screen-web-apps/ and if I understand correctly, both showNotification and setAppBadge must be 'promise' from same \"push\" event.","author":{"url":"https://github.com/edvinv","@type":"Person","name":"edvinv"},"datePublished":"2024-01-15T10:34:42Z","url":"https://github.com/angular/angular/issues/53920"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c0c83f34-372f-7bb5-7b78-d72f5e56139d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B054:16AB79:144FF51:19D8BDC:6B012ABF |
| html-safe-nonce | 400851ecef25a93b9ee3a139caeaf0b6a21e3497d622fb6490dea2c7e13dc7e5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMDU0OjE2QUI3OToxNDRGRjUxOjE5RDhCREM6NkIwMTJBQkYiLCJ2aXNpdG9yX2lkIjoiODIzNjQ5NTM4NzA0NTczNTEwMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 11b9df91eb4fc38a1d8b56c0063b905ccac9b6c6bc1bfc43a12f212c41ef581f |
| hovercard-subject-tag | issue:2081742854 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/53920/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3dbe03323ea570d9353d4cbe0387aad1bbfbbdecba5a089418c058a29b49e31e/angular/angular/issues/53920 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3dbe03323ea570d9353d4cbe0387aad1bbfbbdecba5a089418c058a29b49e31e/angular/angular/issues/53920 |
| og:image:alt | Which @angular/* package(s) are relevant/related to the feature request? service-worker Description Currently you can use Push notification for displaying notification messages. But it is not possi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | edvinv |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width