3

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"

dalgard
  • 3,614
  • 2
  • 22
  • 28
  • How about indexeddb ? – Kyaw Tun Aug 15 '13 at 00:15
  • Thanks, I already use whatever is present through Lawnchair - problem is Android native only has Web SQL. Luckily, every day that goes by, fewer people use 2.3 :) – dalgard Aug 21 '13 at 18:03
  • Check this, might be of help: http://stackoverflow.com/questions/18237112/increase-the-size-of-the-websql-quota-in-a-webview/18837536#18837536 – Chepech Sep 18 '13 at 12:32

2 Answers2

1

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.

Kyaw Tun
  • 12,447
  • 10
  • 56
  • 83
  • 1
    I have given a size of 15 MB, unfortunately it makes no difference. I fear that the native browser only lives up to the minimum requirements of the spec. Notice the word "may": "User agents should limit the total amount of space allowed for databases"--"User agents **may** prompt the user when quotas are reached"--"A mostly arbitrary limit of five megabytes per origin is recommended". On iOS the limit is 50 MB with two prompts. – dalgard Jun 24 '13 at 14:08
1

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/

oligofren
  • 20,744
  • 16
  • 93
  • 180