Page 1 of 1

Saving User Settings Permanently - i.e. locally

Posted: Thu Apr 11, 2013 10:03 am
by Andy Parker

Is there a way to save users settings within the app?
I've used the settings service in the hope that this would work, but the changes are not reflected once the app restarts.
I need to have a way of storing user selections for when the app opens. I don't want to use the cloud database as I want to keep the app self contained.

regards

Andy


Saving User Settings Permanently - i.e. locally

Posted: Thu Apr 11, 2013 10:28 am
by Alena Prykhodko

Hi Andy!

Use Local Storage to save your settings.

Please take a look here http://docs.tiggzi.com/tutorials/buil...


Saving User Settings Permanently - i.e. locally

Posted: Thu Apr 11, 2013 11:41 am
by Andy Parker

many thanks :-)


Saving User Settings Permanently - i.e. locally

Posted: Thu Apr 11, 2013 12:23 pm
by Andy Parker

One last question on this topic, as it's working now;

How can I test to see if the local storage variable has been set?

ie, when the app loads I need to read in the "username".
If local storage "username" has not been set yet, I'll get an error.

Is there a test I can perform?

regards

Andy


Saving User Settings Permanently - i.e. locally

Posted: Thu Apr 11, 2013 1:19 pm
by Alena Prykhodko

Hi!

Run JavaScript action with the following code:

codeif (localStorage.getItem("var_ls") == 0)
alert ("Error");
else
alert(localStorage.getItem("var_ls"));/code

where var_ls - your local storage variable.