I'm working on a project that stores many images when the app is running.
Say for instance an app when installed uses about 30 megabytes of device storage, but after it launches and during operating, it requires 90 megabytes additional storage to operate properly.
Does iOS allocate and limit storage for apps when they run?
Does iOS notify apps when storage is low or completely used, and if so in what way?
Does iOS allocate and limit storage for apps when they run?
iOS does not limit storage. If a device runs out of it, you'll get write fails.
Does iOS notify apps when storage is low or completely used, and if so in what way?
There is no such notification to subscribe for. I suggest you just to check the free space left periodically and swiftly handle write errors.
As for you case you could allocate some kind of a scratch file for "reserving" the capacity you need, but this is not a friendly approach.
You could also notify the user that x MBs of space is left and app will stop working if it's gone under y MBs of space.
Related
I have a PWA designed in Ionic and we are using it to take pictures. However the requirements is that it needs to work offline so we are storing these pictures in IndexDB.
However I have been unable to track down how much storage we will have access to in IndexDB and am concerned it will only be around 50MB or so. The the customer potentially wants to store 100 images or more offline and when it gets back to wifi it will start sending up to a remote API.
Is there any information on storage capability for indexDB when a PWA is run on a mobile device either IOS or Android?
I have seen some posts that but mainly talk about storage of the javascript files where this is actual data captured while the app is running.
NOTE: Individual images will be no more than 2-3MB each in size.
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
The PWA could store pictures up to 128GB * 6% = 7.68GB?
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.
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?
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.
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.
I am creating a Progressive web app(PWA) using angular javascript. where I need to store images and videos downloaded from the server.
I have explored on local storage and IndexedDb, both have limitation in storage size. The official document says, Safari browser allocates max of 50 MB and Chrome mobile allocates 6% of free disk space for local storage.
Is there any option to store the images and videos of large size locally and display the same in PWA app when the device is in offline?
You can't bypass the storage constraints set by the browsers(different for each browser as you have observed). Most of the browsers will let you store more(with users permissions where applicable) but that has to be noted is, these data can also be deleted by the browser without your application having any control over preventing it.
Its a snadboxed storage your browser allocated to your app and it can always take back on different scenarios.. like when the disk space goes low, user clears cache etc.,
You can rely on it as long as you have a fallback when the file is cleared. If you are thinking of storing GBs of data, this option is not for you. But if it goes couple of hundred MBs, you should be okay with most browsers, provided user accepts to allocate the space.
We are developing an in-house app which will have access to a large amount of image data which we would prefer to be off-line.
In short at first start-up the app will pull down the data from a server (around 3Gb) and then only get the data again when the user asks for an update. I simply want to know if there are any size limits for persistent local storage?
Again note this is an in-house app for around 100 users and they are near servers with WiFi, all devices are iOS6, retina (new basically). The updates will only be a few times a year and we may even code it so only changes are downloaded.
There are no limits to the amount of data your app can store. We have apps pulling down over 10GB of data with no trouble.
The only thing you need to be careful of is storing the data in the Caches directory (or setting the 'do not backup' flag) to avoid it being backed up to iCloud if the user has that configured on their device.
In other words lets say I have an app that allows users to create their own data (like the camera app), what happens when the picture that is taken exceeds the remaining memory on the device ?
That's up to the operating system to handle those situations. Remember, a phone, smart phone, works pretty much like a computer. The same way your computer would notify you that is running out of available space... or an error that can't copy... look into the developer API, there should be a way to handle this exceptions.