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
Developer
songdawg
Posts: 59
Registered: ‎06-08-2011
My Device: n/a

Local Storage Orphaned?

I have a Webworks application that uses local storage to persist data. There’s a behaviour that I have noticed happening to two different devices (9900 and 9780 OS 6.0.0.666). The users have noticed that the application data keeps getting deleted (favourites they have earmarked in the app are gone, local variable that indicates initial sync was completed is gone etc). The application stores the data in  local storage and I am suspecting that somehow the application is losing its relationship to local storage and perhaps storing the data elsewhere. That is until it is removed from memory again and they experience the same behaviour. 

 

The local storage file is there but was last modified over a month ago. It should have had today’s timestamp. Also when I deleted the local storage, the application was still able to run and was getting the data from somewhere else.

 

Has anyone seen a similar behaviour with the local storage? Do you know what would cause it or what could be done to prevent it?

BlackBerry Development Advisor
chadtatro
Posts: 620
Registered: ‎10-01-2009
My Device: Z10

Re: Local Storage Orphaned?

Hello,

 

I've used localStorage in a similar way and never noticed that happening.  The exception is when I would do an OS update. In my case I was saving some oauth access tokens in localStorage.  

 

My data was saved even upon battery-pulls so this seems a bit odd.

 

Is anything changing on the phone(s)?  Any OS updates, or anything else like that?  

Chad Tetreault | App Development Consultant | BlackBerry Developer Relations | developer.blackberry.com | @chadtatro
Developer
songdawg
Posts: 59
Registered: ‎06-08-2011
My Device: n/a

Re: Local Storage Orphaned?

That is interesting -thanks.

 

We upgraded the OS and policy before we installed the application so that woudn't be the cause. We have looked to see if there were any other changes and it doesn't look like it.

BlackBerry Development Advisor
chadtatro
Posts: 620
Registered: ‎10-01-2009
My Device: Z10

Re: Local Storage Orphaned?

I'm assuming the app id in your config.xml hasn't changed either?  There seem to be certain OS 6 builds that localStorage didn't perform as expected on, but the 9900 running OS7 I don't have an answer as to why this would be happening to some users.  

 

Is this an app that's already being distributed?  Could it be that some users are emailing in saying their favourites are gone, but it's happened because they're doing os updates, etc?

 

Lastly, how are you setting the localStorage variables exactly?  Can you paste a code snippet just in case something is off there?

Chad Tetreault | App Development Consultant | BlackBerry Developer Relations | developer.blackberry.com | @chadtatro
Developer
songdawg
Posts: 59
Registered: ‎06-08-2011
My Device: n/a

Re: Local Storage Orphaned?

Thanks Chad.

 

This is an app that is already being distributed in our organization through BES. The app id has not changed. It is unlikely that the users perform their own OS upgrade as it is my understanding that this is done from the BES and before we deployed this application we upgraded everyone to at least OS 6.0.0.666.

 

Does this mean that we can no longer upgrade devices without possibly breaking the localstorage connection? What about policy changes?


Here is sample code I am using to access localstorage. We are using GUIDs as keys.

//to set
localStorage.setItem(key, JSON.stringify(object));

 

//to get
JSON.parse(localStorage.getItem(key));