progressive-web-apps

ionic 3 publish app as PWA (Progressive Web App)

↘锁芯ラ 提交于 2019-12-03 18:43:56
问题 I want to publish my app as PWA so what i did is insert this script to index.html <!--script> if ('serviceWorker' in navigator) { navigator.serviceWorker.register('service-worker.js') .then(() => console.log('service worker installed')) .catch(err => console.log('Error', err)); } </script--> then install npm run ionic:build --prod it looks like it deploy it but my questions are: what files I need to upload to host for publish the app as PWA? why when I change something in the app and run

Can a progressive web app (PWA) run a background service on a mobile device to get data from hardware (accelerometer, gps…)?

只谈情不闲聊 提交于 2019-12-03 16:56:11
问题 I see we can check the capabilities of a mobile browser using https://whatwebcando.today/, but can the hardware APIs be queried when not running on foreground? I mean... With PWA am I able to build an app that gets hardware info while running in background, just like Octo U, for Android, and posts that info to a web server? 回答1: The modern method of running code "in the background" is by using a service worker, either via its push event handler (triggered via an incoming push message), or via

Ionic 3's PWA & Firebase Cloud Messaging registration

风格不统一 提交于 2019-12-03 15:50:24
I was following this article here (which is not complete unfortunately) in attempt to learn how to friend Ionic 3 based PWA and Firebase Cloud Messaging: Push Notifications with FCM What I did: as advised in the article added FCM libraries into service-worker.js: 'use strict'; importScripts('./build/sw-toolbox.js'); importScripts('https://www.gstatic.com/firebasejs/4.9.0/firebase-app.js'); importScripts('https://www.gstatic.com/firebasejs/4.9.0/firebase-messaging'); firebase.initializeApp({ // get this from Firebase console, Cloud messaging section 'messagingSenderId': '47286327412' }); const

Angular 7 - service worker not registered

跟風遠走 提交于 2019-12-03 15:43:32
问题 I did everything as written in "https://angular.io/guide/service-worker-getting-started" to make my application PWA. Used exactly this commands: ng add @angular/pwa npm install http-server -g ng build --prod http-server -p 8080 -c-1 dist Then I opened this url on Chrome (in incognito) http://127.0.0.1:8080 When I open tools for developers (f12) > Applications > Service Workers there is no service worker available and website don't work when I set offline there. Additional info about my

How to add analytics for Push notifications

♀尐吖头ヾ 提交于 2019-12-03 13:48:16
问题 I'm working on progressive web app, and I want to implement analytics for Push notifications. How can I add analytics for push notifications so that I'll be able to track and record how many people clicked on notification and how many people close that notification without clicking on it. 回答1: I've written a small chunk of code to use Google analytics for analytics and it works fairly well. Dumped notes here: https://gauntface.com/blog/2016/05/01/push-debugging-analytics The way I've done

Firefox: Service Worker: SecurityError: DOMException: The Operation is insecure

ⅰ亾dé卋堺 提交于 2019-12-03 13:32:31
In app.js , I am checking the serviceWorker existence in navigator object and if available then registering the SW. if ('serviceWorker' in navigator) { navigator.serviceWorker.register('./service-worker.js', { scope: './' }) .then(function(registration) { console.log("Service Worker Registered!"); }).catch(function(err) { console.log("Service Worker not registered!", err); }); } When trying to register SW, I receive the below error in Firefox. I also made sure the service-worker.js file is under src directory. Checking my about:config in Firefox (version 59.0.2) I had service worker and

Update Service Worker in Facebook Browser

為{幸葍}努か 提交于 2019-12-03 13:31:30
问题 Got a problem where some of our users have a buggy Service Worker sitting in their Facebook Browsers from our sites. The problem: Facebook App users are getting our 'you are offline page' on the FB browser when they access our pages shared on FB. The bug appeared to be that an old version of Google's Workbox (3.6.1) was automatically returning the 'You Are Offline' page in the FB app using Chrome 75. Updating Workbox fixed it. The reference to Workbox was in the service worker, so when we

Cordova + Angular 4 + Typescript boilerplate template

混江龙づ霸主 提交于 2019-12-03 12:34:48
问题 I'm working on a Web Progressive App using Angular 4. This app needs to be wrapped up in an Apache Cordova as a Hybrid app built for Android and iOS platforms. I'm looking for a working boilerplate template for Cordova + Angular 4. Cordova is using www folder for web app and Angular 4 is using src folder for web app. How to merge this two together to work? Angular 'ng serve' should also work? 回答1: I finally manage to solve my problem. We need to merge Cordova "www" folder and angular "src"

'Unexpected token <' on every new build of angular production PWA until site refresh

给你一囗甜甜゛ 提交于 2019-12-03 12:26:13
I know there are some similar questions like so unexpected token after angular 2 production build but it doesnt actually answer my question. Basically I have an angular app and its a PWA, now everytime I do a new production build the first time I visit the site I get an error like so and then as soon as I refresh the page, the site works as normal. This happens on any browser/device Now my suspicion is that every time the app is updated, the main bundled js file changes, and the PWA has cached the old one and the app is still trying to use the new one. My Project structure is as follows I have

How to make Angular Universal and PWA work together?

ⅰ亾dé卋堺 提交于 2019-12-03 10:09:15
I have a SSR Angular app which I am trying to transform into a PWA. I want it to be server-side rendered for SEO and for the "fast first rendering" that it provides. The PWA mode works fine when combined with SSR, but once the app is loaded, when we refresh it, the client index HTML file is loaded instead of the server-side rendered page. I have dug into the code of ngsw-worker.js and I saw this: // Next, check if this is a navigation request for a route. Detect circular // navigations by checking if the request URL is the same as the index URL. if (req.url !== this.manifest.index && this