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

Native Development

Reply
Developer
babakar
Posts: 711
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later
Accepted Solution

storing local data

I have a feature remember me in my app, when user selects it..i want next time he enters the app to see his past selected remember me option.

 

so i wanna store things locally in mobile, how can this be done?

Please use plain text.
Developer
BBSJdev
Posts: 6,089
Registered: ‎07-05-2012
My Device: Playbook, Z10 LE, Dev Alpha C
My Carrier: Orange

Re: storing local data

If it's just options you should use QSettings...

 

http://developer.blackberry.com/native/reference/cascades/qsettings.html

 

It's not recommended to use this for application data however, instead you should use SQL, XML or JSON.

 


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
Developer
babakar
Posts: 711
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: storing local data

can u tell me whats best way to use, and show me a link to how?

I tell you what I got.

drop down menu, if he selects say index 2... next time he enters the app the drop down menu would come selected at index 2.
Please use plain text.
Developer
BBSJdev
Posts: 6,089
Registered: ‎07-05-2012
My Device: Playbook, Z10 LE, Dev Alpha C
My Carrier: Orange

Re: storing local data

I thought I had, the link I gave you led to a document riddled with code examples. :smileyhappy:

 

If you need to see it working I suggest you download and take a look at the Persistant Objects app in the samples...

 

http://developer.blackberry.com/native/sampleapps/


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
Developer
greenmr
Posts: 875
Registered: ‎03-20-2013
My Device: Red LE Developer Z10
My Carrier: Fido

Re: storing local data

@BBSJdev... Is it my imagination, or are more and more posters asking others to write their code for them?



Developer of Built for BlackBerry certified multiFEED RSS/Atom feed reader and aggregator.
Please use plain text.
Developer
babakar
Posts: 711
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: storing local data

okey so to store i do this

 

QSettings settings("MySoft", "Star Runner");
        settings.setValue("jack", 10);

 

 

i am trying to check how can i get settings.getvalue("jack")


how can that be done?

Please use plain text.
Developer
babakar
Posts: 711
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: storing local data

sorry i got it settings.value("whatever").toint()

i dont need much lkocal storage, just this one.even password/username wont have remember me feature. this is just drop down
Please use plain text.
Developer
babakar
Posts: 711
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: storing local data

I wasnt asking for code..
but rather his opinion on what way is best to go

that is use local storage?
or write/read from json file in my app?

I am going with qsettings
but one question, if user uninstalls program..then installs it..will the persisentanc eobject be deleted as well?

thank you
Please use plain text.
Developer
babakar
Posts: 711
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: storing local data

another question, where is the object stored?
QSettings settings("MySoft", "Star Runner");

settings.setValue("jack",selIndex);

when i do this, where is it stored? is it secure?
Please use plain text.
Developer
BBSJdev
Posts: 6,089
Registered: ‎07-05-2012
My Device: Playbook, Z10 LE, Dev Alpha C
My Carrier: Orange

Re: storing local data

[ Edited ]

The conf file is stored in the data folder so it will be persistent across application updates.

For storing settings this is absolutely the correct way to do it.

Only your app can access this folder so also secure.

 

As soon as you start storing user inputted data then don't fall in to the trap of sticking with this, 'just because it's easy', but instead look at using JSON, SQL or XML.

 


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.