简体   繁体   English

用于Progressive Web App的Android状态栏图标

[英]Android Status Bar Icon for Progressive Web App

When a progressive web app (with service worker) shows a notification, the notification displayed in the notification drawer has the icon that I supply and looks fine. 当渐进式Web应用程序(带有服务工作者)显示通知时,通知抽屉中显示的通知会显示我提供的图标并且看起来很好。

However, when the drawer is closed, the status bar icon associated with that notification is specific to Chrome, shown here in the red circle. 但是,当抽屉关闭时,与该通知相关联的状态栏图标特定于Chrome,此处显示为红色圆圈。 This happens whether viewed as a web page or when added to the home screen and running with display "standalone". 无论是作为网页还是添加到主屏幕并以“独立”显示运行,都会发生这种情况。 在此输入图像描述

Is there any way for a PWA to specify the icon that shows in the status bar? PWA有没有办法指定状态栏中显示的图标?

Turns out that the options for the showNotification method can have both icon and badge . 事实证明, showNotification方法的options可以同时包含iconbadge The badge shows as the system icon, and the icon shows in the notification message. 徽章显示为系统图标,图标显示在通知消息中。

Finding documentation for this is not easy, but https://notifications.spec.whatwg.org/ gave enough clues to figure this out. 找到这方面的文档并不容易,但https://notifications.spec.whatwg.org/提供了足够的线索来解决这个问题。

Pointers to good (current) documentation about this would be appreciated! 指向关于此的良好(当前)文档的指针将不胜感激!

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM