Building Progressive Web Apps by Tal Ater

If you follow me on twitter you probably know that I am all in on Progressive Web Apps. That's why I was so excited to hear Tal Ater was writing a book on the topic. Full disclosure Tal sent me an ebook version that I could read but don't tell him I was planning on purchasing it anyway.

I had really high expectations for the book as Tal is the author of some really great open source software like AnnYang for adding speech recognition to your site and UpUp for detecting when your site is off-line. I knew I wasn't going to be disappointed when the first chapter opened up with a Patrick Rothfuss quote from his amazing book The Name of the Wind.

This book is the definitive tome on Progressive Web Apps. Tal does a fantastic job of introducing the topic of Progressive Web Apps to readers who may be unfamiliar with PWA's. The book is structured so that you progressively add functionality to a fictional website The Gotham Imperial Hotel. It's super easy to follow along as all the code for the site is hosted on GitHub.

While taking the reader through enhancing the site you will learn some topics that I haven't seen well covered elsewhere like the Service Worker Lifecycle. Having a solid understanding of the service worker lifecycle will help you understand what caching strategy to use for various files in your app. Too frequently tutorials on PWA's only describe the cache only strategy but this book will introduce you to a number of caching strategies besides cache only like cache, falling back to network; network only; network, falling back to cache; cache, then network; etc.

Moving on from caching strategies one of the most powerful abilities of services workers is the ability to do Background Synchronization. Tal walks you through how to provide excellent offline support for your web app starting with saving data locally with IndexedDB, moving to adding Background Sync to your service worker and finally communication between the service worker and the app using post messages. Each one of these chapters flows naturally and when you are done you'll have a web application that is tolerant of network connectivity.

The rest of the book covers important topics like setting your your site to be recognized as a PWA using manifest.json and the always controversial topic of push notifications. Yes, PWA's can do push notifications but ask yourself, "Should I bother my users?" before sending any push message.

So, if you couldn't tell by the glowing review above I highly recommend you pick up this book if you want to learn more about Progressive Web Apps.

Building Progressive Web Apps by Tal Ater (Amazon affiliate link)

April Showers Bring May Travels

Oh man, that's a horrible title. I'm kinda ashamed I wrote that but it's done now and there is no way to change things on the internet. Anyway, for most of the month of May I'll be in and around the EU hitting up conferences and meet up's. If you are in any of these cities and would be interested in getting together for a coffee to talk shop please let me know.

First I'll be headed to Basel, Switzerland on May 2nd and 3rd for an internal Adobe Open Source Summit. Then I'll head over to Berlin, Germany for JS Conf EU from May 4th to 7th. Next I'm popping over to London to talk at a Women Who Code meet up. It is in London where I hope to finally be able to see Guardians of the Galaxy Vol 2, so please no spoilers. Up next is a jaunt over to JS Day ES where I'm speaking on the 13th but hanging around for a few more days before I end up in Amsterdam on the 16th for PhoneGap Day EU which is on the 18th and 19th.

It should be a great, but busy, trip. If you have any good suggestions for things to see in do particularly in Berlin or Madrid please tweet them at me.

 

cordova-plugin-allow-backup

Any Android applications that target Android 6.0 (API level 23) or higher automatically participate in Auto Backup. This is because of the android:allowBackup attribute, which enables/disables backup. The property defaults to true in cordova-android projects as it is omitted from the AndroidManifest.xml file.

<application ...
    android:allowBackup="true">
</app>

This may cause you an issues if you are trying to clear localStorage as it will automatically be restored when the app is re-installed. As well the phonegap-plugin-contentsync project stores it's files in a backed up directory on Android.

If you don't want this default behaviour on Android you can disable Auto Backup. Include cordova-plugin-allow-backup in your project:

cordova plugin add cordova-plugin-allow-backup

If you want to set the property to true use the BACKUP  variable.

cordova plugin add cordova-plugin-allow-backup --variable BACKUP=true

UPDATE!!!

So I totally biffed on the fact that edit-config is now supported in config.xml as well as plugin.xml so you don't need the above plugin. All you need to do is add an edit-config section to your config.xml file like this:

<platform name="android">
    <edit-config file="AndroidManifest.xml" 
                 target="/manifest/application" 
                 mode="merge">
        <application android:allowBackup="false"/>
    </edit-config>
</platform>