安卓奥利奥有了PWAs的味道

原文地址




新的安卓版本8,名字是奥利奥,“热量”比较高,终于有了PWAs(progressive web apps)的味道。安卓奥利奥除了图标改进,画中画外,还提供了更安全的功能:让所有的公共WiFi热点连接都通过VPN。而进一步整合Chrome以后,终于可以实现一部分PWAs功能了,这对许多开发者是非常好的消息,因为意味着Web应用和混血Web应用将更加像本地应用,无论从应用的外表到内部机制。

虽然安卓奥利奥的模拟器里包括了Chrome,极大地便利了开发者,但是仍然有一些很酷的安卓本地功能没有提供给PWAs,比如通知点,可变图标,通知通道等等。

原文链接:https://medium.com/

抄录:

Android Oreo takes a bite out of Progressive Web Apps

On August, 21st after the solar eclipse, Google released the final version of Android 8 now known as Android Oreo. The sun wasn’t the only thing that was hidden for a while today, as Progressive Web Apps have acquired new problems.

I’ve installed Android 8 on my Google Pixel, and I’ve tested a couple of things regarding websites and PWAs and then I have a couple of bad news to share.

Android Instant Apps are the only mention to something related to the Web or browser in the Android Oreo website. It seems to repeat last Google IO keynote, where Android Instant Apps appeared as more important than PWAs from an Android’s perspective.

But let me start with good news: software updates can solve most of the problems. The issue is that nobody seemed to care enough about it to do it before the Android release that is currently being delivered to users.

Broken Add to Home Screen

Let’s start stating the worst problems: on Opera Mobile, Samsung Internet, and Firefox the “Add to the Home screen” feature is not working. While Firefox is not supporting Web App Manifest yet for standalone display, it supports bookmarks to the Home Screen.

No icon appears after Adding on the Home screen on Samsung Internet and Opera using Oreo

On these browsers when you add a website or PWA to the Home screen, nothing happens. Nothing. No icon appears, and the browsers seem to understand everything is ok. Web App Banners appears correctly without luck after accepting the icon installation.

My first guess is that the old shortcut API is not working and these browsers had to update to the new Pinned Shortcuts API.

If you had installed icons with these browsers before installing Android 8.0, they would still work after the upgrade. The problem seems to be in the icon installation.

“Add to Home Screen” still works correctly on Google Chrome, but from the other browsers we will need to wait for an update at Google Play.

New Installation Process in Chrome

This screen appears after we accept the icon installation dialog

Using Google Chrome, we have a new step before actually installing the icon: the home screen place selector. Here we can use “Add automatically” that will find a free spot where to install the icon or you can touch and hold the icon and drop it wherever you want it. The problem is that this new process has a new step that might decrease a little bit installation rate.

The new process involves:

1- Open the menu.

2- Select Add to Home screen.

3- Edit the title and press “Add.”

4- Press “Add Automatically” or touch and hold the icon to place it manually.

If the Web App Banner appears, steps 1 and 2 will be replaced by one step: press “Add to Home screen” on the banner.

Icons are not what you expect any more

The Chrome badge now appears on every PWA icon on the Home Screen

Up to Android 7.1, Chrome and Android were honoring the icon that you set inside the Web App Manifest (or meta tags as a fallback) without any transformation.

Starting with Android Oreo, every shortcut added from Chrome (and potentially other browsers as well, but they are not working now) will have a Chrome badge at the lower right corner of the icon.

This is bad for PWAs as we want to offer the user an app-like experience; the Chrome icon doesn’t help for the user to understand it as an app. And many companies won’t be happy about it.

The other issue with icons is that if your icon is not a perfect circle with a transparent background, the icon is treated as square and it’s reduced to fit entirely within the boundaries of a white circle. You can see the same PWA icons installed in the same device on Android 7.1 and Android 8:

On Android Oreo, icons have the badge and if they are not a perfect centered circle, they are embedded inside a white circular icon, reducing their original size.

In the previous image, the Lyft, Get Kana! and NASA icons are suffering for this issue while Garbarino, Flipkart and AliExpress keeps their original icons.

I don’t have confirmation but it seems icons for PWAs are following now the App Shortcut Icon Design Guidelines.

Any icon installed previous to Android 8 upgrade maintains the original icon; changes happen if you install the icon after the upgrade.

WebAPK will be our hero

While we can’t do anything about it, for now, one solution might appear when WebAPK becomes stable in the future. WebAPK is a new feature in Google Chrome that creates a native Android Package container (APK) and signs it server-side for our PWA. It’s currently available in Chrome under a flag “Improved Add to Home screen” and in Canary by default.

With WebAPK enabled, icons are back to normal as we were used in Android before Oreo. There is no public information yet on when WebAPK will become available but I guess (and hope) that these problems will speed things up.

And WebAPK will solve the issue for Chrome only. Samsung Internet, Opera, Firefox and other browsers will have the same icon problems unless Google opens WebAPK to third-party browsers as Google is the only one that can sign those on-the-fly generated APKs.

Public Open WiFi hotspots now under a VPN

Android supports now a feature that will connect automatically to open access points (those without any security) and it will use a Google VPN as a secure tunnel to increase security. That means that your users will appear to your server as coming from Mountain View, USA. The original IP address is not available in the HTTP headers, so Google is not honoring the X-Forwarded-For header.

Android 8 goodies not available to PWAs

Android Oreo added a couple of things that can be useful for PWAs, but are still out of reach for Web content as of today, such as:

Notification Dots: when an app has a pending notification, a dot will appear on the icon.

Adaptive Icons: which can display a variety of shapes across different device models. For example, an adaptive launcher icon can display a circular shape on one OEM device, and display a square on another device

Notification channels: it will let us define categories of notifications that we want to receive from an app/website.

Shortcuts: options that will appear when you touch and hold an icon

Someone though this was a good idea. But Android Oreo has some good ideas we want to see in PWAs. www.flickr.com/photos/jeepersmedia/14206784113

Any good news?

Before ending the article, I’ve some good news regarding web development on Android 8. Let’s cover them quickly.

Chrome and PWA emulation

You can test everything that I’ve mentioned here even if you don’t have an Android 8 device as of today, Android emulator (available with Android Studio) now includes Google Chrome (version 58).

Android 8 Emulator now includes Chrome for Web and PWA testing, including the ability to connect a Remote Inspector

Picture-in-Picture for video playing

If you have a tag now, PiP is supported in Chrome. I’m not sure it has the right UX now though: you need to open the video in full screen mode and then press the Home Screen. At that point the video will continue playing as a PiP small floating window that you can move around and close it.

PiP works with most HTML5 video tags. Somehow, it’s not working on YouTube so I’m sorry, you won’t be able to watch Despacito again in PiP mode.

Google needs to work harder on PWAs

PWAs with Oreo?

We usually criticize Apple a lot regarding support for the Web Platform, but PWAs on other platforms, including Android, are still in early stages. And I’m sorry to say that. I want to say something nicer here.

I tweeted about something similar during last Google I/O where my feeling was Google doesn’t care about PWAs. And I’m saying Google, not Chrome. Weird? Yes.

I know some people at the Chrome team is doing an outstanding job, but some things (such as WebAPK) are taking too much time to get ready (I tweeted about it 14 months ago).

The Android team doesn’t seem to care too much about PWAs: the support for Instant Apps and the problems stated in this post on today’s release for me are enough probe to say it, and it’s harming a little bit current PWAs’ trust.

I also know some people will reply saying that PWAs are more about Service Workers than about Web App Manifest and the icon installation, but you know… It sounds good, but I don’t think SW alone is selling the PWA idea to companies.

Let’s work on making it work better in the future!

Maximiliano Firtman is a mobile + web developer, trainer, speaker, and writer. He has authored many books, including High Performance Mobile Web published by O’Reilly Media. He is a frequent speaker at conferences worldwide and he has been widely recognized for his work in the mobile-web community. He teaches mobile, HTML5, PWA and performance trainings for top companies around the world. He has delivered several Progressive Web Apps workshops and trainings at Fluent, ForwardJS, Safari Live Trainings, Dutch PHP Conference, ITMaster and more places. Twitter: @firt

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 214,951评论 6 497
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 91,606评论 3 389
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 160,601评论 0 350
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 57,478评论 1 288
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 66,565评论 6 386
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 50,587评论 1 293
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,590评论 3 414
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,337评论 0 270
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,785评论 1 307
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,096评论 2 330
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,273评论 1 344
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,935评论 5 339
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,578评论 3 322
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,199评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,440评论 1 268
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 47,163评论 2 366
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,133评论 2 352

推荐阅读更多精彩内容