What are the chances that Google also starts to kill PWAs?
How to open PWA from Google Play in Google Chrome instead of WebView? - Stack Overflow
cordova - Is there a way to submit a reactjs PWA on Google Play? - Stack Overflow
Google analytics with PWA
Videos
type of web application that can be cached through network and works as a standard native app
I was distraught, but not entirely surprised, to see that Apple decided to effectively kill PWAs (in the EU, at least for now). Google no doubt has been a champion of PWAs for years, and most of the literature you can find online was written by the Chrome team. Do you guys think they could pull a move like Apple just did? Given they basically own search, I feel like they're more invested in the web than Apple is, so they would be more hesitant to harm web tech.
We only recently finished our first PWA which we use as our Android app (https://play.google.com/store/apps/details?id=com.coursicle.coursicle), replacing the native one we had maintained for years. It's been a huge breath of fresh air (Android represents ~20% of our mobile users but took up ~40% of our development time). We'd be devastated if we had to throw away all that work and go back to native.
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:
PUBLIC_URL=.
resolved the path error and the application works now well!
The advice of Sergio running on device with chrome chrome://inspect helped me a lot
months 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 )
var appName = 'myApp';
var PhoneGapInit = function (appName) {
this.boot = function (appName) {
ReactDOM.render(
<Router>
<Route exact path="*" component={ApplicationAsync} />
</Router>,
document.getElementById('root')
);
};
if (window.cordova !== undefined) {
// "Found Cordova";
var self = this;
document.addEventListener('deviceready', function() {
self.boot(appName);
}, false);
return;
}
// 'PhoneGap not found, booting manually';
this.boot(appName);
};
window.addEventListener('load', () => {
new PhoneGapInit(appName);
});
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
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<script type="text/javascript" src="cordova.js"></script>
</body>
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
- Connect your device with the application installed ( must be DEBUG version, not release )
- Open the Chrome console and near the last tab you should see a three vertical dots icon, click it and select 'more tools', then 'remote devices', you should see your connected device listed. Select it
- Find your application in the list and click the 'inspect' button, at this point you shold have your application opened also in Chrome browser.
Hope it helps
No, you can't, at least not as useful PWAs.
Let's first take a look at the definition of Progressive Web Apps:
A progressive web app (PWA) is an app that's built using web platform technologies, but that provides a user experience like that of a platform-specific app.
Like a website, a PWA can run on multiple platforms and devices from a single codebase. Like a platform-specific app, it can be installed on the device, can operate while offline and in the background, and can integrate with the device and with other installed apps.
Source
I'll start with the "can operate while offline" specification - that is pretty much impossible to achieve on user's side with many web apps, as they rely on pulling data frequently from the internet. There are PWAs that ignore this and don't even handle lack of connection properly, but I wouldn't necessarily call them fully proper PWAs.
Then we have integration with systems. For example with notifications. This and offline handling is done with help of service workers, which you can't easily define as a user for any sort of websites either. It's also optional in theory, but if you skip such features, there's not much point of PWAs.
And lastly the most important part - ability to install it as an app on various devices. This is done by linking a manifest in the HTML, e.g.:
<link rel="manifest" href="manifest.json">
The manifest defines basic PWA info, such as icons, where the application should start, how it should be displayed, etc.
This part could perhaps be achievable by dynamically adding the tag with your own external manifest through userscript, but once again, I see no point in doing that and it's not even worth trying as adding a website to e.g. your bookmarks is basically a much more optimal equivalent.
A PWA (Progressive Web App) is different from a website. It has to be written to be a PWA. A PWA can also be used as a webpage or website.
But you can store shortcuts to normal websites on your desktop.