I want to use the "Write once, run everywhere"
So I created a PWA in reactjs with create-react-app.
My app works greatly, and I can put it on the home screen of my mobile from the website. However, I want to be visible on mobile stores too (starting with Google Play).
I tried:
- Microsoft pwaBuilder which doesn't seems to work (the downloaded bundle is not recognized by Google play)
- Packaging my app in Cordova (by copying files of the reactjs build in www) but I'm stuck with a white screen like some other people (publishing PWA on app stores : google play and ios itunes, Reactjs with cordova)
Is there a way today to deploy a reactjs PWA app on a store? That would realize my great dream about progressive web apps :)
Yes there is way to publish your PWAs to PlayStore.
TWAs
Trusted Web Activities are a new way to integrate your web-app content such as your PWA with your Android app using a protocol based on Custom Tabs.
TWAs uses The Digital Asset Links protocol and API enable an app or website to make public, verifiable statements about other apps or websites. For example, a website can declare that it is associated with a specific Android app, or it can declare that it wants to share user credentials with another website.
Checkout the following link for complete guide to launch PWA to Appstore by Google Developers forum and tutorial guide on medium by Maximiliano Firtman here
The problem was about the create-react-app PUBLIC_URL environment variable which was unfilled.
With a
cordova run browser
, all seems to be ok as browser seems to be more permissive in the path resolution. I had as example a/favicon.ico
But when i was doing
cordova run android
, path were not found at runtime.By creating a new file
.env
and put in it:resolved the path error and the application works now well!
The advice of Sergio running on device with chrome
chrome://inspect
helped me a lotmonths ago I've developed a small ReactJS application using Cordova/Phonegap that actually works so I think you miss a couple of details in order to make your application works.
First, did you wait the deviceready event before to bootstrap ReactJS? Your entry point should be something like this ( code is quite old, I used it in an old AngularJS application and adapted it just to bootstrap ReactJS )
Second, using Webpack I've found necessary to use this webpack plugin to have cordova object available, https://github.com/markmarijnissen/webpack-cordova-plugin ( everything is explained there )
Moreover your index.html should contain a body tag like this
The first step should be enough to have your application running.
Also, it is important to know that using Chrome it is possible to access the console to see what is happening in the application, just follow these steps
Hope it helps
The simple answer is there's currently no way to directly add your PWA to the Google Play Store, Apple's iTunes or Microsoft's App Store. You can, however add your PWA directly to Amazon's App Store. For the rest of them, you have to first create a wrapper for it, then deploy the wrapper package to the store. Since you specifically asked about Google Play Store, you basically need two files (see below), plus a few supporting files, which will be automatically created for you when you create a new Android project in Android Studio (or similar environment). You need a main activity that launches your PWA starting URL, something like:
You don't need a XML layout file (you could just create the WebView in code) but in case you prefer configuring options in xml, it'd be something like this:
Finally, you need the AndroidManifest.xml:
Then, you need Android build tools to create your package. If you've downloaded Android Studio, you are all set. The good thing is that, once you've published your wrapper app, you don't need to change it much but can focus on updating just your PWA.
For Microsoft App Store, the process is similar. You don't necessarily need Visual Studio. You can just use PWABuilder's package as a base, remove whatever you don't need and create an "app package upload file" with (Windows) command-line tools.
For iTunes, you need another wrapper and AFAIK, the only way to create one is with (Apple's) Xcode IDE.