TL;DR: See the last paragraph for the solution that ultimately solved it for me.
I have had the navbar on a PWA remain, even though I tried everything, so I thought I would share everything I did, what worked, and how I solved it finally, so you won't have to search for solutions online for hours like I had to.
Extending on @alvaropaco's answer, in the .zip file you get from PWABuilder, you must place the assetlink.json
file in a folder named .well-known
, directly under your domain. It should be accessible at https://www.your-domain.com/.well-known/assetlink.json, or the navbar will not become hidden. No exceptions. Read the README.html that came with your .apk:
Next steps for getting your PWA into the Google Play Store You've successfully generated a Google Play Store app package (.apk
file)
for your PWA. 😎
Your next steps:
- Deploy
assetlinks.json
to your server.
- Test your package on an Android device or Android emulator.
- Upload your
apk
file to the Google Play Store.
Each step is explained below.
1. Deploy assetlinks.json
Your zip file contains assetlinks.json
. This is a digital asset links file
that proves you own your PWA's domain. Upload this file to your server
at https://example.com/.well-known/assetlinks.json
. (Replace
example.com with your PWA's URL.)
💁♂️ Heads up:
Digital asset links are required for your PWA to load without the browser address bar. If you're seeing a browser address bar in your
app on Android, your assetlinks.json
file is missing, inaccessible,
or incorrect. See our asset links helper to fix
this.
If you are not building you app with PWABuilder; maybe using bubblewrap instead, or something else, here are some sources to help you get started building an assetlinks.json file:
Sidenote:
When building my app with bubblewrap, I kept getting this annoying error that wouldn't let me continue because there was a problem installing Android SDK tools:
C:\Users\Me\Desktop\app>bubblewrap build
,-----. ,--. ,--. ,--.
| |) /_,--.,--| |-.| |-.| |,---.,--. ,--,--.--.,--,--.,---.
| .-. | || | .-. | .-. | | .-. | |.'.| | .--' ,-. | .-. |
| '--' ' '' | `-' | `-' | \ --| .'. | | \ '-' | '-' '
`------' `----' `---' `---'`--'`----'--' '--`--' `--`--| |-'
`--'
Installing Android Build Tools. Please, read and accept the license agreement
build Installing Build Tools
Error: Could not find or load main class com.android.sdklib.tool.sdkmanager.SdkManagerCli
cli ERROR undefined
I posted a separate stack overflow answer related to this problem.
Verify assetlinks.json
To verify that assetlinks.json is correctly recognized on an Android device, run these steps: (you need to install adb and grep, first though):
Debugging Digital Asset Links
After you generated your signed APK. it can be installed into a test device, using adb:
adb install app-release.apk
If the verification step fails (if the address bar is still visible) it is possible to check for error messages using the Android Debug Bridge, from your OS’s terminal and with the test device connected.
adb logcat | grep -e OriginVerifier -e digital_asset_links
Now, make sure you app is closed completely (force stop it), and re-open it.
If it is failing you'll see Statement failure matching fingerprint. Verification failed.
message. Therefore is important to review AndroidManifest.xml and build.gradle files and check if the configurations are matching with the assetlinks.json.
Otherwise Verification succeeded.
message should appear.
source
What if assetlinks.json is verified but the navbar still persists?
I was having this problem, but I finally solved it with the help of this GitHub issues post. It turned out that I had the host
parameter in twa-manifest.json
(not manifest.json
because I built it with bubblewrap - it has more flexibility than PWABuilder, though it only works for Android) set to https://example.com
instead of www.example.com
(note the www
) where my site is actually hosted. So if you build it with PWABuilder, first go to your site in the browser, click on the address bar, copy the entire URL (Example: www.example.com and not https://www.example.com or https://example.com), and paste that into PWABuilder.
The address bar should be gone.
start_url
in my manifest.json other thanindex.html
– Billboardhttps://example.com/appName
. There is not custom port. Just, the start_url in manifest looks like/appName/index.html
. It seems that is something else. – Billboard