简体   繁体   English

有没有办法使用渐进式网络应用程序 (PWA) 添加徽章通知?

[英]Is there a way to add badge notifications using progressive web apps (PWA)?

I'm developing a progressive web application (PWA) that will eventually send notifications to users.我正在开发一个渐进式 Web 应用程序 (PWA),它最终会向用户发送通知。

I already know I'm able to send push notifications (like any regular app), as explained in the following blog post: https://developers.google.com/web/fundamentals/getting-started/codelabs/push-notifications/?hl=en-us .我已经知道我可以发送推送通知(就像任何常规应用程序一样),如以下博客文章中所述: https : //developers.google.com/web/fundamentals/getting-started/codelabs/push-notifications/ ?hl=en-us

I also know that I can add a PWA to the home screen, by creating a simple manifest file ( https://developers.google.com/web/updates/2014/11/Support-for-installable-web-apps-with-webapp-manifest-in-chrome-38-for-Android ).我也知道我可以通过创建一个简单的清单文件( https://developers.google.com/web/updates/2014/11/Support-for-installable-web-apps-with)将 PWA 添加到主屏幕-webapp-manifest-in-chrome-38-for-Android )。

However, after having the app in home screen, I would like to add a "hint" to users, letting they know that they have to access the application.但是,在主屏幕上安装应用程序后,我想向用户添加一个“提示”,让他们知道他们必须访问该应用程序。 A great way to do that is doing something like a "badge notification" (as showed in Facebook icon on the image below).一个很好的方法是做一些类似“徽章通知”的事情(如下图的 Facebook 图标所示)。

显示 Facebook 图标上的徽章通知示例的图像

Is it possible to add this kind of behavior using progressive web applications?是否可以使用渐进式 Web 应用程序添加这种行为?


Update - December, 15th, 2018更新 - 2018 年 12 月 15 日

Google recently launched a post explaining about the so called "Badging for App Icons", which is pretty exciting:谷歌最近发布了一篇文章,解释了所谓的“应用图标徽章”,这非常令人兴奋:

https://developers.google.com/web/updates/2018/12/badging-api https://developers.google.com/web/updates/2018/12/badging-api

Update - September, 28th, 2018更新 - 2018 年 9 月 28 日

Relevant Links: 相关链接:

As Josh Lee pointed out in Is there a way to add badge notifications using progressive web apps (PWA)?正如 Josh Lee 在有没有办法使用渐进式网络应用程序 (PWA) 添加徽章通知中所指出的那样 , there are some discussions about the subject on the chromium team. ,在 Chromium 团队有一些关于这个主题的讨论。

Looking at the discussion :讨论

FYI, the notification indicators are being pushed to M-71.仅供参考,通知指标正在推送到 M-71。

and

Thanks for the heads up.谢谢你的提醒。 That's fine for us because while we hope to have this testable behind a flag in M70, there's no way we'll be launching the API before (at least) M71.这对我们来说很好,因为虽然我们希望在 M70 的标志后面有这个可测试的,但我们不可能在(至少)M71 之前启动 API。

So, maybe, at least for now, it seems that it's not possible to add badge notifications for PWAs, but maybe in the future we'll be able to do that.所以,也许,至少现在,似乎不可能为 PWA 添加徽章通知,但也许在未来我们能够做到这一点。

I'm developing a progressive web application (PWA) that will eventually send notifications to users.我正在开发一个渐进式 Web 应用程序 (PWA),它最终会向用户发送通知。

I already know I'm able to send push notifications (like any regular app), as explained in the following blog post: https://developers.google.com/web/fundamentals/getting-started/codelabs/push-notifications/?hl=en-us .我已经知道我可以发送推送通知(就像任何常规应用程序一样),如以下博客文章所述: https : //developers.google.com/web/fundamentals/getting-started/codelabs/push-notifications/ ?hl = zh-CN

I also know that I can add a PWA to the home screen, by creating a simple manifest file ( https://developers.google.com/web/updates/2014/11/Support-for-installable-web-apps-with-webapp-manifest-in-chrome-38-for-Android ).我也知道我可以通过创建一个简单的清单文件( https://developers.google.com/web/updates/2014/11/Support-for-installable-web-apps-with)将 PWA 添加到主屏幕-webapp-manifest-in-chrome-38-for-Android )。

However, after having the app in home screen, I would like to add a "hint" to users, letting they know that they have to access the application.但是,在主屏幕上安装该应用程序后,我想向用户添加一个“提示”,让他们知道他们必须访问该应用程序。 A great way to do that is doing something like a "badge notification" (as showed in Facebook icon on the image below).做到这一点的一种好方法是执行“徽章通知”之类的操作(如下图所示,在Facebook图标中显示)。

显示 Facebook 图标上的徽章通知示例的图像

Is it possible to add this kind of behavior using progressive web applications?是否可以使用渐进式 Web 应用程序添加这种行为?


Update - December, 15th, 2018更新 - 2018 年 12 月 15 日

Google recently launched a post explaining about the so called "Badging for App Icons", which is pretty exciting:谷歌最近发布了一篇文章,解释了所谓的“应用图标徽章”,这非常令人兴奋:

https://developers.google.com/web/updates/2018/12/badging-api https://developers.google.com/web/updates/2018/12/badging-api

Update - September, 28th, 2018更新 - 2018 年 9 月 28 日

Relevant Links: 相关链接:

As Josh Lee pointed out in Is there a way to add badge notifications using progressive web apps (PWA)?正如 Josh Lee 在有没有办法使用渐进式 Web 应用程序 (PWA) 添加徽章通知中所指出的那样 , there are some discussions about the subject on the chromium team. ,在 Chromium 团队有一些关于这个主题的讨论。

Looking at the discussion :讨论

FYI, the notification indicators are being pushed to M-71.仅供参考,通知指标正在推送到 M-71。

and

Thanks for the heads up.谢谢你的提醒。 That's fine for us because while we hope to have this testable behind a flag in M70, there's no way we'll be launching the API before (at least) M71.这对我们来说很好,因为虽然我们希望在 M70 的标志后面有这个可测试的,但我们不可能在(至少)M71 之前启动 API。

So, maybe, at least for now, it seems that it's not possible to add badge notifications for PWAs, but maybe in the future we'll be able to do that.所以,也许,至少现在,似乎不可能为 PWA 添加徽章通知,但也许在未来我们能够做到这一点。

I'm developing a progressive web application (PWA) that will eventually send notifications to users.我正在开发一个渐进式 Web 应用程序 (PWA),它最终会向用户发送通知。

I already know I'm able to send push notifications (like any regular app), as explained in the following blog post: https://developers.google.com/web/fundamentals/getting-started/codelabs/push-notifications/?hl=en-us .我已经知道我可以发送推送通知(就像任何常规应用程序一样),如以下博客文章所述: https : //developers.google.com/web/fundamentals/getting-started/codelabs/push-notifications/ ?hl = zh-CN

I also know that I can add a PWA to the home screen, by creating a simple manifest file ( https://developers.google.com/web/updates/2014/11/Support-for-installable-web-apps-with-webapp-manifest-in-chrome-38-for-Android ).我也知道我可以通过创建一个简单的清单文件( https://developers.google.com/web/updates/2014/11/Support-for-installable-web-apps-with)将 PWA 添加到主屏幕-webapp-manifest-in-chrome-38-for-Android )。

However, after having the app in home screen, I would like to add a "hint" to users, letting they know that they have to access the application.但是,在主屏幕上安装该应用程序后,我想向用户添加一个“提示”,让他们知道他们必须访问该应用程序。 A great way to do that is doing something like a "badge notification" (as showed in Facebook icon on the image below).做到这一点的一种好方法是执行“徽章通知”之类的操作(如下图所示,在Facebook图标中显示)。

显示 Facebook 图标上的徽章通知示例的图像

Is it possible to add this kind of behavior using progressive web applications?是否可以使用渐进式 Web 应用程序添加这种行为?


Update - December, 15th, 2018更新 - 2018 年 12 月 15 日

Google recently launched a post explaining about the so called "Badging for App Icons", which is pretty exciting:谷歌最近发布了一篇文章,解释了所谓的“应用图标徽章”,这非常令人兴奋:

https://developers.google.com/web/updates/2018/12/badging-api https://developers.google.com/web/updates/2018/12/badging-api

Update - September, 28th, 2018更新 - 2018 年 9 月 28 日

Relevant Links: 相关链接:

As Josh Lee pointed out in Is there a way to add badge notifications using progressive web apps (PWA)?正如 Josh Lee 在有没有办法使用渐进式 Web 应用程序 (PWA) 添加徽章通知中所指出的那样 , there are some discussions about the subject on the chromium team. ,在 Chromium 团队有一些关于这个主题的讨论。

Looking at the discussion :讨论

FYI, the notification indicators are being pushed to M-71.仅供参考,通知指标正在推送到 M-71。

and

Thanks for the heads up.谢谢你的提醒。 That's fine for us because while we hope to have this testable behind a flag in M70, there's no way we'll be launching the API before (at least) M71.这对我们来说很好,因为虽然我们希望在 M70 的标志后面有这个可测试的,但我们不可能在(至少)M71 之前启动 API。

So, maybe, at least for now, it seems that it's not possible to add badge notifications for PWAs, but maybe in the future we'll be able to do that.所以,也许,至少现在,似乎不可能为 PWA 添加徽章通知,但也许在未来我们能够做到这一点。

I'm developing a progressive web application (PWA) that will eventually send notifications to users.我正在开发一个渐进式 Web 应用程序 (PWA),它最终会向用户发送通知。

I already know I'm able to send push notifications (like any regular app), as explained in the following blog post: https://developers.google.com/web/fundamentals/getting-started/codelabs/push-notifications/?hl=en-us .我已经知道我可以发送推送通知(就像任何常规应用程序一样),如以下博客文章所述: https : //developers.google.com/web/fundamentals/getting-started/codelabs/push-notifications/ ?hl = zh-CN

I also know that I can add a PWA to the home screen, by creating a simple manifest file ( https://developers.google.com/web/updates/2014/11/Support-for-installable-web-apps-with-webapp-manifest-in-chrome-38-for-Android ).我也知道我可以通过创建一个简单的清单文件( https://developers.google.com/web/updates/2014/11/Support-for-installable-web-apps-with)将 PWA 添加到主屏幕-webapp-manifest-in-chrome-38-for-Android )。

However, after having the app in home screen, I would like to add a "hint" to users, letting they know that they have to access the application.但是,在主屏幕上安装该应用程序后,我想向用户添加一个“提示”,让他们知道他们必须访问该应用程序。 A great way to do that is doing something like a "badge notification" (as showed in Facebook icon on the image below).做到这一点的一种好方法是执行“徽章通知”之类的操作(如下图所示,在Facebook图标中显示)。

显示 Facebook 图标上的徽章通知示例的图像

Is it possible to add this kind of behavior using progressive web applications?是否可以使用渐进式 Web 应用程序添加这种行为?


Update - December, 15th, 2018更新 - 2018 年 12 月 15 日

Google recently launched a post explaining about the so called "Badging for App Icons", which is pretty exciting:谷歌最近发布了一篇文章,解释了所谓的“应用图标徽章”,这非常令人兴奋:

https://developers.google.com/web/updates/2018/12/badging-api https://developers.google.com/web/updates/2018/12/badging-api

Update - September, 28th, 2018更新 - 2018 年 9 月 28 日

Relevant Links: 相关链接:

As Josh Lee pointed out in Is there a way to add badge notifications using progressive web apps (PWA)?正如 Josh Lee 在有没有办法使用渐进式 Web 应用程序 (PWA) 添加徽章通知中所指出的那样 , there are some discussions about the subject on the chromium team. ,在 Chromium 团队有一些关于这个主题的讨论。

Looking at the discussion :讨论

FYI, the notification indicators are being pushed to M-71.仅供参考,通知指标正在推送到 M-71。

and

Thanks for the heads up.谢谢你的提醒。 That's fine for us because while we hope to have this testable behind a flag in M70, there's no way we'll be launching the API before (at least) M71.这对我们来说很好,因为虽然我们希望在 M70 的标志后面有这个可测试的,但我们不可能在(至少)M71 之前启动 API。

So, maybe, at least for now, it seems that it's not possible to add badge notifications for PWAs, but maybe in the future we'll be able to do that.所以,也许,至少现在,似乎不可能为 PWA 添加徽章通知,但也许在未来我们能够做到这一点。

I'm developing a progressive web application (PWA) that will eventually send notifications to users.我正在开发一个渐进式 Web 应用程序 (PWA),它最终会向用户发送通知。

I already know I'm able to send push notifications (like any regular app), as explained in the following blog post: https://developers.google.com/web/fundamentals/getting-started/codelabs/push-notifications/?hl=en-us .我已经知道我可以发送推送通知(就像任何常规应用程序一样),如以下博客文章所述: https : //developers.google.com/web/fundamentals/getting-started/codelabs/push-notifications/ ?hl = zh-CN

I also know that I can add a PWA to the home screen, by creating a simple manifest file ( https://developers.google.com/web/updates/2014/11/Support-for-installable-web-apps-with-webapp-manifest-in-chrome-38-for-Android ).我也知道我可以通过创建一个简单的清单文件( https://developers.google.com/web/updates/2014/11/Support-for-installable-web-apps-with)将 PWA 添加到主屏幕-webapp-manifest-in-chrome-38-for-Android )。

However, after having the app in home screen, I would like to add a "hint" to users, letting they know that they have to access the application.但是,在主屏幕上安装该应用程序后,我想向用户添加一个“提示”,让他们知道他们必须访问该应用程序。 A great way to do that is doing something like a "badge notification" (as showed in Facebook icon on the image below).做到这一点的一种好方法是执行“徽章通知”之类的操作(如下图所示,在Facebook图标中显示)。

显示 Facebook 图标上的徽章通知示例的图像

Is it possible to add this kind of behavior using progressive web applications?是否可以使用渐进式 Web 应用程序添加这种行为?


Update - December, 15th, 2018更新 - 2018 年 12 月 15 日

Google recently launched a post explaining about the so called "Badging for App Icons", which is pretty exciting:谷歌最近发布了一篇文章,解释了所谓的“应用图标徽章”,这非常令人兴奋:

https://developers.google.com/web/updates/2018/12/badging-api https://developers.google.com/web/updates/2018/12/badging-api

Update - September, 28th, 2018更新 - 2018 年 9 月 28 日

Relevant Links: 相关链接:

As Josh Lee pointed out in Is there a way to add badge notifications using progressive web apps (PWA)?正如 Josh Lee 在有没有办法使用渐进式 Web 应用程序 (PWA) 添加徽章通知中所指出的那样 , there are some discussions about the subject on the chromium team. ,在 Chromium 团队有一些关于这个主题的讨论。

Looking at the discussion :讨论

FYI, the notification indicators are being pushed to M-71.仅供参考,通知指标正在推送到 M-71。

and

Thanks for the heads up.谢谢你的提醒。 That's fine for us because while we hope to have this testable behind a flag in M70, there's no way we'll be launching the API before (at least) M71.这对我们来说很好,因为虽然我们希望在 M70 的标志后面有这个可测试的,但我们不可能在(至少)M71 之前启动 API。

So, maybe, at least for now, it seems that it's not possible to add badge notifications for PWAs, but maybe in the future we'll be able to do that.所以,也许,至少现在,似乎不可能为 PWA 添加徽章通知,但也许在未来我们能够做到这一点。

"On Android, the Badging API is not supported. Instead, Android automatically shows a badge on app icon for the installed web app when there is an unread notification,... " “在 Android 上,不支持 Badging API。相反,当有未读通知时,Android 会自动在已安装的 Web 应用程序的应用程序图标上显示一个标记,......”

Has anyone been able to confirm this?有没有人能够证实这一点? I am not finding any truth to this.我没有找到任何真相。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为渐进式 web 应用程序(PWA)添加“徽章通知” - Add "badge notification" for progressive web application (PWA) 在 iOS 中为渐进式 Web 应用推送通知 - Push Notifications in iOS for Progressive Web Apps 带有2个按钮的Android推送通知用于渐进式Web应用程序? - Android push notifications with 2 buttons for Progressive Web Apps? 渐进式 web 应用程序 (PWA) 无法在 android 手机的屏幕上弹出推送通知 - Progressive web app (PWA) not able to make push notifications pop up on screen of android phone PWA 的推送通知或 Web 推送通知 - Push notifications or Web push notifications for PWA 渐进式Web应用程序的局限性:将本机应用程序转换为渐进式Web应用程序 - Limits of Progressive Web Apps: transforming a native app into a progressive web app 受信任 web 应用程序中本机 android 和渐进式 web 应用程序之间的双向桥接 - Two way bridge between native android and progressive web apps in trusted web application Videoportal PWA(Progressive Web App)视频离线功能? - Videoportal PWA (Progressive Web App) Video offline function? 为Android中的未读通知添加通知徽章 - Add Notification Badge for unread Notifications in Android Chrome 徽章显示在已安装 PWA 的“添加到主屏幕”上(仅安装快捷方式) - Chrome Badge shows on 'Add To Homescreen' installed PWA (Only shortcut is installing)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM