Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Developer
Posts: 58
Registered: ‎04-04-2012
My Device: Z30, Z10LE, Q5 & PlayBook
My Carrier: German Provider
Accepted Solution

Problem with localStorage on the PlayBook: QUOTA_EXCEEDED_ERR

Hi everyone!

 

I try to store some data to the localStorage on the PlayBook. In this case roundabout 2.6 MB, For that amount the QUOTA_EXCEEDED_ERR error is raised and I have no clue why? I thought the limit is about 5 MB? And I hoped that the PlayBook would ask the user to give more memory to the app.

 

Is there a way to force more memory space for localStorage? 2.6 MB is not that much, and I expect much more data in some cases.

 

This is my piece of code, any help would be really much appreciated:

 

localStorage.removeItem("items");
localStorage.setItem("items", JSON.stringify(this.getItemsAll()));

Cheers,

Sven

---
Developer ReadItNow!, PhotoUpload, WhereIs...?, Magic4Square and OrganizeMe!

http://sven-ziegler.com
Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: Problem with localStorage on the PlayBook: QUOTA_EXCEEDED_ERR

Hello, the current max size is in fact 5Mb.  From the sounds of it, you estimate you are using about 1/2 of that.  Could it be that the character encoding being used is using 2 bytes per character?  e.g. the string "Hello World" in UTF-8 uses 22 bytes, not 11.

 

I was curious about this myself when I first started playing around with local storage and so created the following "load test" to explore what the upper limit was.

 

The way I found that limit was to keep pressing the "Load Local storage" button until nothing happens.  Then remote one of the zeros in the input field and try again.  Keep repeating this until you get to "1" being in the input field

http://blackberry.github.com/WebWorks-Samples/kitchenSink/html/html5/storageloadtest.html

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Highlighted
New Developer
Posts: 58
Registered: ‎04-04-2012
My Device: Z30, Z10LE, Q5 & PlayBook
My Carrier: German Provider

Re: Problem with localStorage on the PlayBook: QUOTA_EXCEEDED_ERR

Thanks for your ultra fast response and you are completely right. Thanks for the link, I tested it successfully on my PlayBook. **bleep**, I didn't even thought about the space needed by UTF-8. 

 

So I will need another storage type for sure, but now I will be able to provide a bugfixed version for the affected app. Thanks again, great support!

 

Cheers,

Sven

---
Developer ReadItNow!, PhotoUpload, WhereIs...?, Magic4Square and OrganizeMe!

http://sven-ziegler.com