The world of applications was classified into two categories not too long ago. You were either creating an application for Android devices or for iOS. Enter PWAs, or elongated, Progressive Web Applications. You have probably been hearing all about them for the past couple of years, but besides a nice acronym, you have no idea what a PWA is. As their popularity increases, it might be a good idea to get to know what all the fuss is about.

In this article, I’ll take you on a tour of what a PWA is, what components it is built from, and show you how you can make one on your own.

The Basics

A progressive web application is a website turned into an application. What this means is, that instead of having to code either in Java or Objective-C (or more recent mobile coding languages), you can write the code for the application, like you would for a website. You have your html files, your stylesheets, and your scripts.

Why would you build a PWA instead of a native application? For starters, imagine that once you release a PWA, you can change it constantly without having to republish your application. Since all the code is hosted on a server and not part of the APK/IPA, any change you make happens in real time.

If you have ever used an application that relies on a network connection, you are familiar with the frustration of not being able to do anything. With PWAs, you have the ability to offer an offline experience to your users in case of network issues.

And to add the cherry on top, there is an ability to prompt the user to add your PWA to their home screen. Something that native applications do not possess.

Components

There is a standard regarding a PWA, and you must adhere to it if you want to publish one. Each PWA is built from the following components:

  • A web app manifest
  • A service worker
  • Install experience
  • HTTPS
  • Creating an APK
  • Lighthouse audit

The Manifest

This is purely a configuration file (.JSON), enabling you to change various settings of your PWA and how it will appear to the user. Below is an example of one:

manifest.json

You must set either a name/short name key. When setting both, short name will be used on the home screen and the launcher. The name value will be used in the Add to Home Screen experience (or, application install prompt).

Display can have four different values:

  • fullscreen – this allows your application to take up the whole screen when it is opened
  • standalone – your application looks like a native application, hiding browser elements
  • minimal-ui – provides some browsing controls (only supported for Chrome mobile)
  • browser – like the name says your application’s look will be identical to a browsing experience

You can also set the orientation of your application and the scope of the pages considered to be within your application.

Don’t forget to add the manifest to your main html file by putting the following meta tag inside of your head tag:

Photo by sol on Unsplash

The Service Worker

A service worker is a component running in the background of your website on the browser. It has a wide set of functionalities including, push notifications, caching assets and providing them for an offline experience and the ability to defer actions until the user has a stable connection to the internet. A service worker can be a whole Medium article on its own, so I won’t delve into the inner details of how it works. But, I will supply a vanilla example of one for you to use in your PWA.

It is customary to save the code related to the service worker in a file called sw.js.

✋ The location of the service worker is important since it can only access files that are in the same directory or subdirectory as itself.

A service worker has a lifecycle that can be summed up to the following phases:

  • Registration
  • Installation/Activation
  • Responding to various events

Pay attention to the comments to understand where to place the different lines of code

Install Experience

One of the unique features of a PWA is its install experience. What this translates to is prompting the user to install your application. To allow us to present this ability to the user, we will need to listen in on an event called beforeinstallprompt. Below is a code sample demonstrating the flow from presenting the user with the option to add the application to activating logic based on their choice.

Install Experience Flow
Photo by James Sutton on Unsplash

HTTPS

Not too long ago, websites could still use the all too common http protocol. Due to recent changes in security and in Chrome, all websites that do not operate under the https protocol will be marked as not secured. Even if your website does not handle user data or sensitive communication, it is still good practice to switch over to https.

And like I mentioned earlier, if you want to be able to release a PWA, it has to use the https protocol. If you don’t want to get into the hassle of acquiring a domain, finding a proper host for it and then enabling SSL, you can go for the easy option of Github. If you have an account, you can open a repository and set up a GitHub Page. This process is fairly simple and straightforward and the bonus is getting the HTTPS built in as part of Github.

Creating An APK

In order for our PWA to be available inside the Google Play Store, we need to create an APK. You can use the popular tool, PWA2APK, which will do the hard work for you. But if you prefer to learn how to do it yourself, keep reading.

Google has introduced a new way to integrate your PWA into the Play store using what is called a Trusted Web Activity, or TWA. With just a few simple steps you will learn how to create a TWA, which you can then upload to the Play store.

  1. Open Android Studio and create an empty activity
  2. Go to the project’s build.gradle file and add the jitpack repository

3. Go to the module level build.gradle file and add the following lines to enable Java8 compatibility

Continue https://medium.freecodecamp.org/an-explanation-of-progressive-web-apps-for-the-non-pwa-crowd-8a400e275ea1

22 replies
  1. office.com/myaccount says:

    Microsoft Office is expert programming to affect your expert looking archive, within the event that you simply simply simply simply want to download ms office visit office.com/myaccount • sign up to office.com/myaccount product key to introducing, downloading and oversee office 365 whenever entered office item key or enter your item key, purchase and acquire official support.

  2. my.avast.com says:

    Avast Account may be a portal that’s designed for managing your paid subscription, download Avast products, get details about your subscription and tons more. Hence, account creation and Avast check in is a crucial process for enhancing your experience. For this, you’ve got to follow the processes mentioned below.

  3. Roadrunner Email says:

    Roadrunner Email may be a cloud-based service that gives you an email account that’s designed with a versatile range of features along side complete proof of protection. Previously, this email service is provided to the users by Time Warner Cable, which may be a well-known Internet Service Provider (ISP).

  4. BullGuard login says:

    BullGuard Internet Security is an extraordinary cybersecurity programming that offers bleeding edge insurance for all your associated gadgets. This all encompassing work area application gives you tenacious security for Windows, Mac and Android gadgets.

  5. BT Mail says:

    BT Mail – Now you may do My BT Login or Btinternet Sign in to Manage BT Account and Access all the features including Compose Mail, etc. It is the largest provider of fixed-line, broadband and mobile services, subscription television and IT services.

  6. Netgear Router Login says:

    Netgear Router Login – Netgear is a leading producer of best-in-class routers that helps the users to enjoy high-speed network connection. Through the routers, you can connect multiple routers with the same internet service provider.

  7. SBCGlobal Email says:

    SBCGlobal Email is known for its highly customizable, feature-rich and user-friendly email services. It offers intuitive features, unbeatable security and comprehensive service that is fast, reliable and effective.

  8. TurboTax Login says:

    First and foremost, you should open your preferred internet browser on your computer. You may have Internet Explorer, Google Chrome, Firefox, Safari, etc. Hence, you have to open any of these browsers available on your computer.

  9. AOL Mail says:

    AOL Mail includes a variety of services i.e. AOL mail, AOL Instant Messenger, AOL Video, video search, news, sports, weather, etc. With the help of AOL
    Mail, you can connect to the millions of people across the world.

  10. Norton.com/setup says:

    Norton is an antivirus software that protects your devices against viruses, malware, spyware, and other online attacks. It helps you in avoiding unsafe websites by giving you regular alerts.

  11. Webroot.com/safe says:

    webroot offers a wide range of products that are packed with ultimate features. For accessing all the features and offerings of the Webroot, you have to follow the Webroot reinstall process.

  12. my.avast.com says:

    Avast is a complete cybersecurity software that provides protection against all the existing, emerging and advanced cyber threats. Online threat protection products by Avast are packed with cutting-edge features

  13. TurboTax Sign In says:

    TurboTax is an American tax software programming. It controls the client’s bit by bit in preparing and documenting their expense forms. This product helps in keeping the records of the earlier year’s assessment forms. Thus, you can utilize different highlights of Turbotax subsequent to finishing the procedure of Turbotax sign in.

  14. Office.com/myaccount says:

    How might it be in the event that you could get to news, email, LIVE games refreshes and can even sign-in your computer by means of simply entering one secret phrase? Truly, it is conceivable in the event that you pursue a Microsoft account by visiting office.com/myaccount.

  15. norton.com/nu16 says:

    this is a nice post—In case you are facing any issue with norton.com/nu16 then we recommend you get in touch with Norton Support. A team of technicians is 24/7 available to assist you with your issues.

  16. Webroot Download says:

    Webroot Download is a cloud-based antivirus software that protects your system against viruses and other online threats. This software offers complete security of your device from malware and viruses. Moreover, it protects you during web surfing sessions by blocking harmful sites.

  17. McAfee.com/Activate says:

    Such a beautiful post thanks for sharing-McAfee.com/Activate is a comprehensive, and intelligent cybersecurity suite that safeguards you, your data, identity, privacy and all your devices at all times. It gives you the advantage of protecting all the devices of a household with a single subscription. It seamlessly integrates “antivirus, privacy, and identity” tools and features that are capable to crush the most advanced security threats.

  18. Office Login says:

    thank you so much for sharing this useful informationMS Office or simply Office gives you the opportunity to simplify your work life by means of a set of dedicated productivity tools. It is a time-tested software suite that is used worldwide for its user-friendly design and reliability. Besides that, it gives you the ease of convenient and quick setup at “Office Login”.

  19. norton.com/nu16 says:

    Unique information you provide us thanks for this -norton.com/nu16 When it comes to antivirus and security applications for their computers, many users choose Norton Security. Norton is a well-known security company that has been collaborated by many big brands for more security. You must have seen the name of the Norton offering security to the websites and more.

  20. 123.hp.com/setup says:

    When you change printer offline to online or giving any other warning then you can connect with our hp customer support team visit my site. Here hp printer users will get solution for all issues. It is available 24*7 for customers help.

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published.