Progressive Web Applications


‘Progressive App design offers us a way to build better experiences across devices and contexts within a single codebase’ (Russel 2015). Progressive Web Applications involves using web development technology to create applications that can run smoothly on multiple platforms and devices without having to make a specific application for each individual platform.

Progressive Web Apps are experiences that combine the best of the web and the best of apps. They are useful to users from the very first visit in a browser tab, no install required. As the user progressively builds a relationship with the app over time, it becomes more and more powerful. It loads quickly, even on flaky networks, sends relevant push notifications, has an icon on the home screen, and loads as a top-level, full screen experience.’ (Your First Progressive Web App. n.d.) They way we use mobile devices compared to desktop devices is quite different, apps are at the center of mobile activity as opposed to on desktop where a large component of our activities take place online.

An example used by Alex Russell, a google chrome engineer, at the 2016 Progressive Web App Summit, was google maps. After a show of hands he observed , not to his surprise, that most people navigated to google maps through the web on their desktop computers, but when asked the same question about mobile, most people put their hands down. If you were to get to google maps on your phone you would more than likely do it via their app. “We don’t really use the web on mobile the way we do on desktop, but remember we started with native apps on desktop too.” (Russell 2016).

People gravitate towards native apps because of their speed, reliability and immersive experience. However in the last few years web technology has developed so that we can achieve a similar speed, reliability and experience as native technology. PWA’s encompass mobile(or desktop) websites that can act and react like native apps, providing offline service, fast interactions and immersive full screen experiences.

“Progressive Web Apps are user experiences that have the reach of the web, and are:

  • Reliable – Load instantly and never show the downasaur, even in uncertain network conditions.
  • Fast – Respond quickly to user interactions with silky smooth animations and no janky scrolling.
  • Engaging – Feel like a natural app on the device, with an immersive user experience.

This new level of quality allows Progressive Web Apps to earn a place on the user’s home screen.” (Progressive Web Apps, n.d.)

Unlike native applications, which require downloading via that app store, Progressive Web Applications “While a PWA can be treated like a standard application on a device, the ability for it to be run from a uniform resource locator (URL) makes it easy to use the application on any device with a browser.”

App Shell Model

“An application shell is the minimal HTML, CSS, and JavaScript powering a user interface. The application shell should:

  • load fast
  • be cached
  • dynamically display content

An application shell is the secret to reliably good performance. Think of your app’s shell like the bundle of code you’d publish to an app store if you were building a native app. It’s the load needed to get off the ground, but might not be the whole story. It keeps your UI local and pulls in content dynamically through an API.”(Gaunt, M. Osmai, A.  2019)

The App Shell Model is different for every Progressive Web Application. Google developer provides a codelab on Progressive Web Apps (Progressive Web Apps, n.d.), this lab provides a guideline set of questions one should ask themselves when designing their app shell model.

  1. What needs to be on the screen immediately ?

On screen immediately, we need the login screen, after this, we will need to go to the “What is Puberty ?” page after which the character will be selected and the diary page can be shown. If they are logging back in it will them straight to the diary page

  1. What other UI elements are key to our app ?

The forward and back arrows to navigate through the pages.A loading gif for content that is downloading or has not yet been downloaded.

  1. What supporting resources are needed for the app shell ?

The background images, button images and a loading gif.

Service Workers

Service workers are Progressive Web Applications solution to offline functionality, they cache previous loads of the application shell and use this when the network isn’t available. Normally if connection fails on a web page, you don’t see any content or you get the offline dino game on screen. Progressive web apps show you shell of the web application even if the content on the page will not be loaded until the connection is established again. This provides users with an experience that more closely emulates that of a native application.  “A service worker is a script that runs in the background, separate from your web page. It responds to events, including network requests made from pages it serves and push notices from your server. A service worker has an intentionally short lifetime. It wakes up when it gets an event and runs only as long as it needs to process it.” (Gaunt, M. Osmai, A. 2019) Essentially, once a user loads the application once the application shell is cached. Once the user reopens the same application, the service worker grabs the application shell from the cache which is stored locally on the device. This not only allows for the application shell to be accessed when the device is offline, it allows for faster loading times than if the application shell was to be downloaded from the network on every single load.

“With offline first we assume of line, and do as much as we can with local content, the try and get content from the network, and the more we get to render without a connection, the better. So you should think of the network as a piece of progressive enhancement, an enhancement that may not be there” (Archibald, J. 2016) Service workers are made using Javascript, and the act as a buffer between the page and the network. Usually page request go straight to the network and the network send things back to the page directly. A service worker is placed between the network and the page so requests from the page must first go through the service worker before they reach the network.

The Application Shell will always be cached locally, because no matter how fast your connection, it will be much faster to retrieve the application shell from the devices cache. This is done using an install event which is triggered when the browser reads the service worker initially. This will not happen by default, and so you must add it to the fetch event, this will then check that if the url is the homepage and if the statement rings true, the application shell will be added to the cache. We then set up the network as a fallback for this request, so that if the data required isn’t available in the cache the page then requests it from the network. “The network only matters to fetch new data, and that’s the offline first goal” (Archibald, J. 2016)

Bibliography

Archbald, Jake 2016 Instant Loading Offline First (Progressive Web App Summit), Google Chrome Developers, viewed on 22/03/2019

Bob Frankston, March 2018, Progressive Web Applications, IEEE Consumer Electronics Magazine, accessed on 21/03/2019 via https://ieeexplore-ieee-org.cit.idm.oclc.org/stamp/stamp.jsp?tp=&arnumber=8287006

Gaunt, M. Osmai, A.  February 2019, Instant Loading Web Apps with an Application Shell Architecture, Google Developer, accessed on 22/03/2019 via https://developers.google.com/web/updates/2015/11/app-shell

Progressive Web Apps, n.d. Google Developer, accessed on 21/03/2019 : https://developers.google.com/web/progressive-web-apps/

Russel, Alex June 15th 2015, “Progressive Web Apps, Escaping Tabs Without Losing Our Souls”, ‘Infrequently Noted’, blog post. Viewed on 21/03/2019 at URL : https://infrequently.org/2015/06/progressive-apps-escaping-tabs-without-losing-our-soul/

Russell, Alex 2016, Opening Keynote (Progressive Web App Summit 2016), Google Chrome Developers, viewed on 21/03/2019 https://www.youtube.com/watch?v=9Jef9IluQw0&index=3&list=PLNYkxOF6rcIAWWNR_Q6eLPhsyx6VvYjVb
Your First Progressive Web App, n.d., Google Developer – Code Lab accessed on 21/03/2019 via https://codelabs.developers.google.com/codelabs/your-first-pwapp/#0

Web Apps

As the PhoneGap Developers App isn’t availible on iOS decided and was incompatible with the tablet I had due to it having the wrong version of android OS I decided to buy a new tablet that had the correct version of android. PhoneGap requires version 5.0 and above so I purchased a tablet that uses version 9.0 and the app was still incompatible with my device. I then decided to downlod the adk of PhoneGapDeveloper, which I was able to install and run but it did’t connect to the applications I was attempting to test on my deskop. This was frustrating, but I figured out after some research on message boards about the application that there is a long list of requirements for devices to be compatible with PhoneGap Developer.

API Levels Supported

  • 15+

Hardware Requirements

  • android.hardware.BLUETOOTH
  • android.hardware.CAMERA
  • android.hardware.LOCATION
  • android.hardware.location.GPS
  • android.hardware.location.NETWORK
  • android.hardware.MICROPHONE
  • android.hardware.screen.LANDSCAPE
  • android.hardware.sensor.ACCELEROMETER
  • android.hardware.sensor.COMPASS
  • android.hardware.TOUCHSCREEN
  • android.hardware.WIFI

Permissions Required

  • android.permission.ACCESS_COARSE_LOCATION
  • android.permission.ACCESS_FINE_LOCATION
  • android.permission.ACCESS_GPS
  • android.permission.ACCESS_LOCATION_EXTRA_COMMANDS
  • android.permission.ACCESS_NETWORK_STATE
  • android.permission.ACCESS_WIFI_STATE
  • android.permission.BLUETOOTH
  • android.permission.BLUETOOTH_ADMIN
  • android.permission.CAMERA
  • android.permission.GET_ACCOUNTS
  • android.permission.INTERNET
  • android.permission.MODIFY_AUDIO_SETTINGS
  • android.permission.READ_CONTACTS
  • android.permission.READ_EXTERNAL_STORAGE
  • android.permission.READ_PHONE_STATE
  • android.permission.RECORD_AUDIO
  • android.permission.RECORD_VIDEO
  • android.permission.VIBRATE
  • android.permission.WAKE_LOCK
  • android.permission.WRITE_CONTACTS
  • android.permission.WRITE_EXTERNAL_STORAGE
  • com.google.android.c2dm.permission.RECEIVE  (Pindoria, Suraj 2016)

I brought this issue to my coding lecturer and he suggested I develop the applications as a web application, which is what I would be doing with PhoneGap anyways. I could then test the application on the device using our college webserver (webdevcit.com). I can get javascript plugins that allow me to make the application full screen and allow me interactivity such as swiping (jquery gestures). I can still then transfer the app files into phonegap and export the application from there at the end of the project, I would just be cutting out the middleman during the development phase.

Making Web Applications Fullscreen

There are several easy ways to make a website fullscreen, you can request the browser to go full screen in response to a user gesture, you app download the website to the homepage, or you can auto hide the address bar. ( Making Fullscreen Experiences, 2019)

How I did this

  1. First I created a HTML and CSS file for the homepage
  2. I added this meta tag to the header of the HTML <link rel=”manifest” href=”/manifest.json”>
  3. I then created a JSON file containing this code
  4. I transferred all the files to the server and opened the web page in the browser. I then from the page settings added the website to the homepage
  5. I opened the application from my homescreen
  6. The Website is now Fullscreen

Drag and Drop Touch Events

On a mobile device there is not mouse, touch events must be used instead. There are plugins available for more complex gestures, but this is how I created a simple drag and drop touch event.

  1. Create HTML Element you want to move and give it an id
  2. Create an onload function, store the HTML element in a variable
  3. Add a touchmove event listener to this variable that triggers another function
  4. Prevent the default movements when the event is triggered
  5. Create a variable that stores the new touch location and use this to change the style of the HTML element.

Current Academic Paper

References

Pindoria, Suraj (2016, July 27) Current Software, Hardware, and Permissions Required.[online from comment] message posted to https://github.com/phonegap/phonegap-app-developer/issues/408#issuecomment-235703076

Making Full Screen Experiences, 2019 , Google Developer, viewed 11 March 2019, via https://developers.google.com/web/fundamentals/native-hardware/fullscreen/

Research on Application Development

My main responsibility for this project is the technical side of developing the application. I have decided to research all options available to us to ensure we choose the right option for our project. This post discusses both the research and the practical work I completed over the first three weeks of the Semester to help me properly understand our options with regards to application development. My work began with desk research and then began to evolve into getting hands on in an attempt to understand the tools that we have at our disposal.

Week One 28/01/2019

IOS Vs Android

This is a huge question that you have to considering when first developing an application and there are numerous factors to take into account. Demographically speaking iOS is a platform generally associated with more affluent users, it is the prominent platform in the US and it’s users and more inclined to spend money on applications. ( Teleman, Costi 2017 ) Android is the prominent platform in developing countries and amongst users who are spend money more consciously. Android is also much more prominent globally. (Katariya, Jayanti 2017)

“You have to consider the whole Android family-from low-range to mid- and high-range iterations when developing and designing your apps. ”

( Teleman, Costi 2017 ). Screen sizes and resolutions can be a difficult aspect of app development for Android because of the open nature system, many different brands and ranges of smartphones exist within the Android family as opposed to iOS which has a more standardised range of screen sizes and resolutions.

Development time is significantly shorter for iOS and hence it is much cheaper. iOS development requires a program called X Code which is only available on Mac. Android development can prove much more time consuming, it requires a program called Android Studio which uses Java and is available on Max, Windows and Linux. ( Teleman, Costi 2017 ).

It is generally agreed, from the resources I have read, that app development is easiIt is generally agreed, from the resources I have read, that app development is easier for IOS. Seeing as we have all got iphones and and ipad this would seem like the most sensible approach for us to take. App Development for IOS requires you to use the program Xcode and the scripting language SWIFT. The issue however lies within the fact that my laptop is a windows laptop, and as I am mainly in charge of the app development side of the project, this may cause an issue.

There are several solutions availible for this issue

  • Use the Macs availible to me in college to complete the coding needed.
  • You can pay for a service which allows you to remotely access a mac os from your PC and hence develop using said virtual OS. The fee for this service is 1 dollar an hour or 20 dollars a month. ”
    Before committing to buying a new Mac, you can actually “rent” one for development. You’ll remotely access the Mac and Xcode through your PC. “(Ching, Chris 2019)
  • We could also use a program like phone gap which allows you to use HTML, CSS and Javascript to develop an application that works on both IOS and Android

Week 2 04/02/2019

Phone Gap

The first option I have looked into using for developing our application is the adobe program PhoneGap. This program allows you to use basic principles of HTML, CSS and Javascript to create an application suitable for both iOS and Android.

I found this software extremely easy to use however I found a slight issue in the fact that the PhoneGap developers app was removed from the app store by apple recently and the issue hasn’t yet been resolved. As I only have an iOS mobile device currently at my disposal I couldn’t test the application on an actual device, only on my browser.

Below is the link to the extremely simple application I created using this software. I created this app to gauge which software will be the best for us to begin to develop our final application.

Pros

  • Applications can be exported to either iOS or Android
  • Relies on HTML, CSS and JavaScript which I already have knowledge of
  • Can use Cordova to access the functionality of the phone hardware
  • Fast and efficient testing using the PhoneGap Developers App

Cons

  • No UI widgets availible
  • PhoneGap developers app not availible on iOS

Phone Gap Test Application

Tutorials Watched

Week Three 11/01/2019

Android Studio

Now, although it is said that android development is slightly harder, it may be the solution to the issues with my laptop being a PC. Android development requires an application called Android Studio which can be used on Mac or PC. This would allow us to develop on any computer however we would have to display on an android device, which we are not currently in possession of. There are ways around that though such as using an android emulator or buying a cheap android device such as the lenovo 7″ tablet for around 50 euro.

I attempted to make a simple application in Android Studio Similar to the one I made in Phonegap However I really struggled with it. Android studio requires the programming language Java of which I don’t have any prior knowledge. to get a handle on Java I completed the code academy course on Java. I also found some manuals on learning Android Studio in the CIT library which would be useful if I were making a full application. I also watched some tutorials on Android Application Development.

Tutorials and Books Mentioned

The main issue I forsee with using Android Studio is the complexity of Learning Java from scratch and understanding it well enough to be able to develop a full application using it. I can follow the tutorials and books aforementioned however I am just copying what hey are doing in the tutorial and I have a very minimal understanding of how this works. This would become a big issue when I am trying to implement our own application as there will be no direct tutorial to follow. I am not confident in my ability to transfer my knowledge of Java from a tutorial and apply it to our own project.

Pros

  • Availible on Mac, Windows and Linux
  • Free Software, plenty of online learning resources
  • Would result in me havng a greater knowledge of Java

Cons

  • Would require me to learn a whole new scripting language from scratch
  • I have found Java very difficult up until this point and doubt my ability to transfer my learnings of onto our project
  • Development Process would probably be more time consuming as I can only use a certain amount of the base knowledge I have as a result of my studies
  • Development for One platform only

Xcode

Xcode development is much simpler and swift is an easier language to get an understanding of . The issue however is the fact that I could only develop for iOS by using a Mac or virtually renting one. As I will be putting a lot of work in both at home and in college into this project, it just doesn’t make sense for me to develop the application using a program I would essentially have to pay per hour of usage at home. So I basically have ruled out the use of Xcode for developing this application but it always there as a backup option it would just require me to use mainly the college computers.

Pros

  • Straightforward Software
  • Developing for a standardised screen size and resolution
  • UI Widgets Available

Cons

  • Can only develop on a Mac (either physical or Virtual)
  • Requires learning swift, which despite being easier than Java is still a new scripting language
  • Development for one Platform Only
  • Requires us to display on apple device (more pricey)

Conclusions

I have decided to move forward and get into prototyping using PhoneGap. The pros of using PhoneGap far outweigh the cons. It will allow me to expand on the skills I have been learning over the past four years, I am comfortable coding in the languages required for using PhoneGap, the software allows you to develop for both Android and iOS platforms and this will allow me to prototype and test efficiently. After speaking to my supervisor and conducting all the above research we decided that this is the most sensible approach going forward for our project and I am happy with this decision.

Bibliography

Jayanti Katariya (2017) Apple Vs Android – A comparative study 2017 [online] Available from URL : https://www.moontechnolabs.com/apple-vs-android-comparative-study-2017/ [ accessed 02/02/2019 13:50]

Teleman, Costi ( 2017), Android vs iOS App Development: A Comparison and Decision Guide [online], Available from URL : https://dzone.com/articles/android-vs-ios-app-development-a-comparison-and-de [accessed 02/02/2019, 14:45 ]

CHING, CHRIS (2019), XCODE FOR WINDOWS (12 WAYS TO BUILD IOS APPS ON PC) [ONLINE] AVAILABLE FROM URL : HTTPS://CODEWITHCHRIS.COM/XCODE-FOR-WINDOWS/ [ ACCESSED 04/02/2019,

18:30]

Academic Paper Current Progress