How to create Progressive web app apk/any type of file that can be distributed in a enterprise devices

21,593

Solution 1

Chrome for Android generates and signs .apk file on the fly using WebPack, when the user clicks on "Add to Home screen" (from menu or install banner) option and if the site has a valid manifest.json and service worker.

Extracting and distributing APK: This .apk can be located and exported to desktop using file explorer tools. For some reason, some of default file explorer tools couldn't locate this .apk file. Once exported, this .apk can be used to distribute in controlled environment..like in enterprise devices, where you can enforce the deceive to have Chrome Browser. If this .apk is installed to devices which don't have Chrome browser, user will get a message saying "Chrome" is required to open this app. Once installed, installed PWA apk can be used.

For distributing PWA apps through Play store, google is streamlining the process. A google engineers repose on building APKs (March-2018), when we reached out to them for our enterprise needs.

"Well done extracting the APK and deploying it, it should give a good experience to end users, but I agree it shouldn't be that complicated to deploy web apps on Android. We are currently working on a streamlined web apps feature, with which you wouldn't need to manipulate or build APKs. This feature will be available on managed devices using Play to deliver apps"

Alternate options: If you think your user base may not have Chrome or don't want to rely on that dependency, wrapping with Cordova kind of hybrid solution is the only way to build your PWA apps for distribution in app stores. With this option, if the "webpack" in the device has the version 40+, user will get PWA benefits. Otherwise, it will still work as a regular hosted web app.

Update on TWA - Trusted web activity is the official way to pack PWA for Android and its available in Chrome 72 and it also supports private/enterprise web apps as the digital assets validation happens in browser now(it use to happen in cloud, making this solution not possible for private web apps).

Solution 2

You can upload the PWA to Playstore using tools like PWA2APK. Just need to share the play store URL to the users, from which they can download PWA app like normal Android App.

Solution 3

Trusted Web activities are a new way to integrate your web-app content such as your PWA with your Android app using a similar protocol to Chrome Custom Tabs.

Trusted Web activities

Share:
21,593
Anand
Author by

Anand

I'm an Architect and Full stack web developer using HTML, CSS, JS, TypeScript, Angular, NativeScript, Java, Spring Boot, SQL, RDBMS, GraphDB, Neo4J. For fun, love riding horse.

Updated on October 28, 2020

Comments

  • Anand
    Anand over 3 years

    Understandably, PWAs (Progressive Web Apps) are added to home screen after the user visits the web app in a supported browser and clicks on "Add to Home Screen". This works fine for publicly available PWAs.

    Thinking of Enterprise Android applications, which needs to be installed to thousands of devices via some app push tools like Airwatch, its practically not possible to have someone open the browser, put the URL and then add to home screen in all thousands of devices.

    Is there any other way to automate this deploy/add icon to home screen of a Progressive Web App, not needing the user to visit the web app in a browser, and clicking on "Add to Home Screen" ?

    One option we thought about is wrapping in Cordova, but we're trying to find a solution without such wrapper.

  • Anand
    Anand almost 6 years
    Thank you for the answer. We are currently evaluating this option as wrt enterprise device distribution. Domain validation and play store distribution makes little difference when it comes to enterprise hosted and side loaded apps. Will update here is this solution works. Thanks again for answering.
  • SebastianG
    SebastianG over 5 years
    Thanks for this. We have the same problem as the OP here. Will give it a shot later today and see if it works for us!
  • Anand
    Anand over 5 years
    This is still not an option as TWA will not work for private web apps as Chrome evaluated TWA criteria in server side, rather than in the browser. Got this confirmation from Chrome team. Things may change post Chrome 69 release. But not an option as of today.
  • Anand
    Anand over 5 years
    Heard from Chrome team that this is not prioritized at least until Chrome 71. Even with that, support for private web app is still uncertain. This would be the ideal solution for many enterprise apps. Unfortunately, not in priority list for Chrome team.
  • Felix josemon
    Felix josemon about 5 years
    Thanks for this answer, additionally one can use PWA2APK, appmaker.xyz/pwa-to-apk to make PWA to Playstore ready Android apps.
  • Felix josemon
    Felix josemon about 5 years
    @Anand, TWA is supported in the newest chrome update. I see a bright future for PWA apps on Playstore. (Although that's like one step down, still People normally resort to proprietor app stores for keepable apps)
  • DevArenaCN
    DevArenaCN about 5 years
    How did you address the signing issue? When I tried to upload that apk it told me that my signing is not valid
  • Felix josemon
    Felix josemon about 5 years
    We create a certificate and we use that to sign the APK. We also provide the certificate, signed APK, source code, and all its details. Regarding the issue, seems strange. Can you try again, this time screenshot the error and mail to us?
  • Flo rian
    Flo rian about 5 years
    Hi I can not find those Apk via ES File Explorer. Whats the Filename (pattern) and where are they stored?
  • Anand
    Anand about 5 years
    Should be the same as application name or with a package name which would be com/ org.chromium.<some big number>. I would recommend not use this apk extraction method for distribution and use TWA instead.