Partial Offline. Partial offline means the vast majority of the time the application is online, however it can continue to work if the internet connection gets temporarily interrupted. A partially offline app understands that requests for remote resources, that is resources that donât exist on the device, will automatically defer to local resource, or at least fail gracefully, during the period of time when an internet connection doesnât exist. Partially offline apps typically cannot be reloaded or restarted offline. The coding required to handle this scenario is much lighter weight than the architecture required for going fully offline. An example of partial offline is a reader app that pre-caches certain HTML pages of your choice. If the internet connection gets disrupted you can continue reading and navigating between the cached pages.
The partially offline scenario exists because there is no such thing as a perfect internet connection for mobile. In reality, internet connections and download speeds are very choppy when measured over a period of minutes or hours. Sure, some internet providers market 4G connections as being extremely fast, or have the best coverage etc., etc., blah. The bottom line is cellular and even WiFi internet connections are not guaranteed. A good example of this is coffee shops. They donât come with an uptime guarantee,Â so ifÂ a couple of yahoos sitting next to you are streaming HD NetflixÂ thenÂ that will surely bring the internet connection to its knees.
In reality, if you donât live danger close to a cell phone tower and are moving around doing your job or running errands chances are your internet connection will fluctuate up and down over time. Anyone that owns a smartphone has experienced this at one time or another. Dropped calls are perfect example. You may be shopping and going in and out of buildings, or hanging out in the back of a taxi, sitting in your car pulled off the side of the road, or perhaps even just watching your kids as they play in the neighborhood park. A web application architected for partially offline will let you keep surfing or working for a short period of time, and hopefully long enough until the internet connection comes back up.
Fully offline apps need to be architected in a much more robust way than their partially offline cousins. Partial offline apps can be considered more fragile than fully offline apps because they canât be restarted or reloaded while offline, and you have to be very careful to limit their capabilities while offline otherwise the user can easily break the app. Fully offline apps are built with the knowledge that they may be offline for extended periods of time and need to be self-sufficient because users will be depending on them. If a fully offline app breaks then the user will be completely hosed (and very unhappy) until some point in the future where the internet connection can be restored and they can resync the app.
Examples of full offline apps include mapping apps, web email, reader apps, and any other apps that require information from a database. Â User data is typically downloaded locally, stored on disk and then accessed by offline web applications. Any data thatâs stored in memory will be lost when if the device or browser is restarted while offline.
Web offline versus Native offline
When building out your requirements, itâs a best practice to do an honest comparison between offline web capabilities and the offline capabilities of native SDKs.Â In general as of the writing of this post, itâs fair to say that native apps still offer much more robust offline capabilities than the latest versions of mobile browsers. There are a few exceptions where browsers may have similar capabilities but almost always the level of control is more limited.
Native apps have the advantage because they basically have direct access to the device operating system and many of the capabilities are simply integrated into the respective SDKs. Here is a partial list of capabilities that are commonly seen in native offline requirements:
- Sensors (check out the entire list, itâs rather extensive)
- Fine grained control over location services.
- Programmatic access to internal and external storage including SQLite and SD Cards. Browsers canât currently access SQLite.
- Internet connectivity detection.
- Battery optimization.
- Ability to continue running even when minimized.
Web apps, on the other hand, run within the browser and are subject to any limitations imposed by the browser. The browser, itself, is a native app and it restricts itâs own children (web apps) to certain security restrictions. A few examples of web app limitations include:
- Access to a limited number of censors. Access is not consistent across different browser types.
- Limited control over location services via HTML5 Geolocation API.
- Internet connectivity detection typically dependent on 3rd party libraries such as offline.js. Support is inconsistent across some platform/browser combinations.
- Indirect and limited control over battery life and optimization.
- Browsers and any of their associated tabs stop running as soon as the browser is minimized. If you have a requirement for the app to âwake upâ from a minimized state under certain conditions you will have to go native.
Partial offline applications are design to continue working gracefully during intermittent interruptions in connectivity. Because offline is considered a temporary or even momentary condition in this use case, partial offline apps can use lighter weight architecture and have smaller data storage needs than full offline apps.
Lastly, when havingÂ conversations about building offline apps you should weightÂ web versus native offline capabilities against your requirements. Native SDKs still offerÂ much richer control over most of the aspects of offline functionality.
Stay tuned for additional posts on this subject. Part 2 will look at the features and APIs you can use to take applications offline.