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
Contributor
Posts: 25
Registered: ‎06-03-2011
My Device: curve 9800
My Carrier: Singtel

Using localStorage Issue

[ Edited ]

I'm stuck

and according to this local storage is supported only in playbook.

http://www.blackberry.com/developers/docs/webworks/api/localStorage.html

 

And i tried using simple localstorage commads like "  oneArray = LocalStorage["myMemory"];  " but it didnt work

Retired
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: Using localStorage Issue

According to this post you'll see that it should be supported 6.0+ .

 

What OS are you trying this on? 

What does "didn't work" mean?



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Developer
Posts: 116
Registered: ‎03-08-2011
My Device: Not Specified

Re: Using localStorage Issue

I created an app that uses local storage and it works flawlessly so I can confirm that it does work. Maybe something incorrect in the code?

Contributor
Posts: 25
Registered: ‎06-03-2011
My Device: curve 9800
My Carrier: Singtel

Re: Using localStorage Issue

Hey there,

 

I am running OS 6. Can you post a code sample here? I have tried several sample codes and they all don't work. Thanks for your help in advance

Developer
Posts: 116
Registered: ‎03-08-2011
My Device: Not Specified

Re: Using localStorage Issue

Sorry. Must have misread your post. My app is for Playbook, not OS6. When I get a chance i'll recompile it for OS6 and test it on my smartphone and let you know if its working.
Contributor
Posts: 25
Registered: ‎06-03-2011
My Device: curve 9800
My Carrier: Singtel

Re: Using localStorage Issue

Thanks that would be awesome!

But from what I have read in the API's it seems local storage is only available for playbook, which is why I was a bit surprised at first.

:smileyhappy:

Retired
Posts: 46
Registered: ‎07-08-2010
My Device: Superberry
My Carrier: Rogers

Re: Using localStorage Issue

Does your code run in Ripple? If yes, does the same code run on the 7.0 simulator?
-------------------------------------------------------------------------------------------------
Useful resources, food for the brain:
Web(Works) KB - http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/tkb-p/browser_dev%40tkb
New Contributor
Posts: 9
Registered: ‎08-21-2011
My Device: Blackberry 9700
My Carrier: Telkomsel

Re: Using localStorage Issue

I have used localStorage extensively in my WebWorks app, for storing sessions, cache, etc. localStorage works perfectly on OS 6 (the browser supports HTML5), even it works perfectly on my 9700 (upgraded to OS 6).The OS 6 simulator also supports localStorage.

 

If you wanted to make sure if localStorage works on your target device, just open http://html5demos.com/ in device browser, click on "storage" filter demo, you should see a green icon if localStorage is supported.

 

A nice reference on how to use localStorage is here:

http://diveintohtml5.org/storage.html

 

The code to implement localStorage is simple:

// reads local storage
var data = localStorage['config'];

// writes to local storage
localStorage["config"] = data;

 hope this helps.

Adityo Hidayat, WebWorks Developer @ PT. Gamatechno Indonesia