Pregunta

I need to save 11 MB of data offline using Web SQL. In iOS I am asked if I want to increase the quota, and everything is fine. But in Android's native browser (2.3-4.2) no such prompt is presented - it simply fails with QUOTA_ERR*.

I have spent many hours doing intensive search and have read absolutely everything related to this problem, but I'm still not completely certain whether I should receive a prompt or not and whether the limit can be pushed up by any means.

Any real info or help will be greatly appreciated.


* "there was not enough remaining storage space, or the storage quota was reached and the user declined to give more space to the database"

¿Fue útil?

Solución

I have tried to research this all day to find out what the maximum sizes for Android and iPhone are. On the current Android 4.x phones the limit seems to be fixed at around 8MB, effectively limiting you to storing json-content of up to 4 million characters (each character is 2 bytes in utf-16).

No Android device I have tested will prompt you when you hit the limit, as opposed to iPhone, which will prompt you both at the time of database creation (with a size >= 5MB) and when you hit each of the limits (5, 10, 25 and 50 megabytes).

You can create several smaller databases, but it will not help you in increasing the total storage on Android which is still limited to 8MB. If you are running in a WebView, that is another story; There you can store up to 50MB on Android, and the same on iPhone (in a UIWebView) - WITHOUT getting prompted.

PS. You might be able to cram the 11MB of data in 8MB if you compress the strings. Do expect approximately a tenfold decrease in read/write speeds. See http://labs.ft.com/2012/06/text-re-encoding-for-optimising-storage-capacity-in-the-browser/

Otros consejos

Have you give estimated database size during opening, like this?

var size = 11 * 1024 * 1024; // 11 MB
var db = openDatabase(db_name, '', description, size);

There will be an upper limit of database size. I am greatly appreciate if you found the upper limit on Android browser.

Thanks.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top