Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PWA on IOS and offline storage

We looking to develop an "App" which would have the ability to record the details of a damaged car for assessors. The idea is that a small number of assessors would have company iPads. Then when car is damaged and returned to the car yard they can visit take photos, enter some details and then upload them into the main system later. Some of the car yards may be in areas that do not have internet coverage, so offline capability is required.

Our initial thoughts were to develop an IOS App for installation on a small number of company iPads. The App could access the camera to take photos and then when the device has internet access upload the photos to the main system. However this solution could prove too costly (regarding development costs) for the customer.

I have read about PWAs and caching data, but the caching seems to be for offline read access.

If we installed chrome on an iPad and then installed a PWA then presumably

  1. The PWA could store pictures up to 128GB * 6% = 7.68GB?
  2. If stored using the File System API then (as long as there is plenty of space on the system) the data will be persisted (my understanding is there is no time limit)? Or would a different type of storage be more suitable.
  3. The offline data is obviously important (may be required in court) so are there any other concerns around persistence & stability before the images are uploaded to the main system?

Note we would prefer to use iPads (as the customer would prefer these) but we could consider other platforms.

At this stage I am really trying to find out if a PWA accessing the offline storage is likely to be feasible, practical and stable on the platform?

like image 591
Jake Avatar asked Jul 30 '18 11:07

Jake


2 Answers

Firstly, iOS restricts third party web browsers (or any app that displays web pages) to using its own engine - installing Chrome on an iPad will not enable access to any web APIs that iOS/Safari doesn't already support.

So in particular:

  • File System API is not available on iOS, even if you're using Chrome
  • Cache API has a storage limitation per website of 50MB
  • IndexedDB has a storage limitation per website of 500MB or half the device's free space (whichever is smaller)
  • PWAs and their cached data are automatically wiped from devices if not used for a few weeks
  • the "navigator.storage" API for requiring durable data is not support on iOS, even if you're using Chrome or Firefox.
like image 173
kh42874 Avatar answered Nov 05 '22 17:11

kh42874


My first thought would be that if you are only going to support iPads and indefinite offline storage is a requirement, you are probably best of with a native application. Keep in mind that for this kind of application you would need the Apple Enterprise Program, which is more expensive than the regular Developer Program.

However, if you do want to use a PWA, your best bet for local storage would be the IndexedDB. As per the comment by skybondsor, browsers do indeed limit and possibly evict data after a while, according to ADM webdocs.

But reading your question, I get the sense that you do not really need persistent local storage, but rather a method ensuring that your data will eventually end up on the server. You can accomplish this by exploiting the Background Sync methodology. This allows your application to delay the upload to when a stable internet connection is available.

like image 21
TmKVU Avatar answered Nov 05 '22 18:11

TmKVU