Android "add to home screen" bug with ssl

I seem to be having the same issue, I had set up a web app with A2HS a number of months ago but I just set up SSL (using a CA-issued certificate) so I needed to recreate the icon. Setting up html5 push notifications did not solve it for me.

Android 9.0, Google Pixel, Chrome 58.0.3029.125, Chrome 61.0.3163.98, Chrome Beta 62.0.3202.52

So after much playing around I was finally able to get the option to appear and work. I changed my default launcher to the Pixel Launcher, then completely closed chrome and re-launched it. Then the option to add to home screen appeared so I switched the default launcher back to Action Launcher, switched back to Chrome, and add to homescreen worked.

Curiously, the shortcut no longer launches in a standalone, full screen instance - it now just opens as another tab within Chrome. So it didn’t really as it as a Portable Web App but rather just created a shortcut.

Same to me. Don’t know what I did, but now I have a link that open a full screen app,and other that open as a chrome tab.

I have the same issue, I think what chrome is doing is installing the app (which is really just a shortcut) rather than creating an icon for the web app. I’ll try setting up html 5 notifications and see if that works for me.

So I ran into some similar issues. For anybody that cares I found that using example.com would fail but www.example.com worked. I needed to add the www version of the URL to the SSL cert to get it to come up with out complaining about “Not secure” but then it seemed fine.

I have the same issue and didn’t see this thread until now so had created another one. Using your suggestion with adding the ‘www’ has allowed it to link properly and open in kiosk mode rather than a chrome tab however I now have a warning bar across the top of the screen… It’s still far better than it opening a chrome tab though

Just cross-posting this here from the other thread:

Seems to have something to to with googles “Progressive Web Apps”. I’m currently assuming PWAs only work with valid SSL. So HA is probably not configured right for PWA support?

EDIT: just confirmed, this is on a page about PWA: “Served via TLS to prevent snooping and ensure content hasn’t been tampered with.” This is definetly the reason this only happens with SSL enabled.

Current workaround that works for me to force a non PWA web app install:

  1. Start HA with a self-signed (invalid) certificate
  2. Install the webapp
  3. Start HA with your valid certificate again, it will continue to work.

Let’s hope that someone with enough knowledge of PWAs can fix this.

Thanks for posting that info from the other linked thread. I found this thread first. I just wanted to add that I am experiencing the same issue. The workaround did work for me so at least it is working properly for now. Hopefully the devs can find the real issue and get it resolved in a future release.

Im having the same issue. Without ssl enabled, adding to the Home screen worked perfectly fine and created the web-app. After setting up DuckDNS and Let’s Encrypt, it now opens a tab in chrome instead. I’m still working on getting the push notifications working but not sure if that will fix the issue.

Same issue here

Found another quick little work around after reading this post.
just go into your config and # out ssl_certificate: /ssl/fullchain.pem and ssl_key: /ssl/privkey.pem. Then restart home assistant. while its restarting navigate to your https url and hit add to home screen and it should work normal. Then un # your ssl_certificate and ssl_key in your config and issue another restart. Now your shortcut on your home screen should be working =]

1 Like

I was able to port forward 443 to 8123 on my router and it fixed the issue with the certificate. Now loading https://example.duckdns.org and Adding to home screen works fine. It’s still an issue if you use https://example.duckdns.org:8123 or https://www.example.duckdns.org since the certificate using the DuckDNS addon doesnt get a cert for that domain.

2 Likes

thank you for that @Neil_Grewal! you saved my evening [was just starting to curse very loud at my hass.io installation ;)]

1 Like

No problem! Glad I could help. I went through the same thing, reset my whole Hass.io setup and was about to give up and found that small trick worked.

Never had this issue, as i added it to my old phone before i setup a valid ssl cert. now added it to my new phone and i get this :frowning:

Tried using 443 instead of 8123 and it works properly. Somehow Android Chrome it isn’t liking HTTPS on a non-standard port.

Just for those still looking to resolve this. I found a super simple method. just turn your phone on Airplane mode, reload the page and than add it while it’s trying to load. it worked for me.

Than of course turn of airplane and the shortcut loads with no issues :slight_smile:

11 Likes

Surprisingly the airplane mode workaround worked for me as well. There is only one caveat: At least in my case the shortcut isn’t created with the home assistant icon but with a generic “first letter of the domain” icon that chrome uses if it can’t load the favicon from the server (obviously because it’s in airplane mode).

If you use a more fancy launcher in android you may be able to change the icon after the shortcut was created by editing the properties of the shortcut.

Here’s a workaround for Nova Launcher users:

Make sure, you still have a shortcut with a proper HA icon in the app list. Apparently the “buggy” shortcut you crated before, that opens a chrome tab instead of the kiosk mode web app works fine.

Create the proper shortcut in airplane mode (see last post by @calberttj). Long tap the new shortcut, choose “Edit” and tap on the icon. Then choose Built-In from the list and select the HA icon from the old shortcut.

After that you may delete and uninstall the old web app. This doesn’t affect the newly created shortcut.

I just tried this on Android 8 and it worked to create the kiosk view but I cant change the icon. The only options I get from a long press are ‘select items’ and ‘remove from home’. That snot the end of the world though, i’m far happier than it opening a chrome tab every time.

As said, changing app icons is a feature, which isn’t offered by most standard Android launchers. The workaround above is for Nova Launcher users only.

If you don’t want to switch to another launcher, there are some apps on the store, which allow to change app icons. Most of them loaded with ads though. But nevertheless they should work as well.