richsaw
Posts: 0
Joined: Thu Feb 16, 2012 5:15 pm

Saving state and data for user next use

Hi, I'm wondering how the state of a screen can be saved so that when a user next opens the app they will be directed to the last screen they were on and any data changed on that screen as they last viewed it?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Saving state and data for user next use

You can save data in Local Storage or save data in mobile back-end such as Parse.com. Either way, when the last screen is loaded, you would read the values and display them on the screen Hope this helps..

richsaw
Posts: 0
Joined: Thu Feb 16, 2012 5:15 pm

Saving state and data for user next use

Thanks Max,

In this case I'd like a user to set the visibility of an image by clicking it.

To save this state do I then add an action to the click event that saves a local storage variable - in this case imagex 'visible'. Then on page load add an event that retrieves the local storage variable imagex 'visible' ?

Just wondering if I can test this in the web browser or whether I would need to move it to the mobile environment? I ask because I tried the above and was unable to see the result in web browser. - Although I haven't added any user-specific data that would remember that a particular user had made the particular change - I guess that is where parse.com would come in to create login credentials?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Saving state and data for user next use

[quote:]
To save this state do I then add an action to the click event that saves a local storage variable - in this case imagex 'visible'. Then on page load add an event that retrieves the local storage variable imagex 'visible' ?
[/quote]
Yes

[quote:]
Just wondering if I can test this in the web browser or whether I would need to move it to the mobile environment?
[/quote]
Yes, you can easily test in any browser.

[quote:]
Although I haven't added any user-specific data that would remember that a particular user had made the particular change - I guess that is where parse.com would come in to create login credentials?
[/quote]
Yes, one option is to use Parse. But maybe you don't have to, if it's one user per browser.

richsaw
Posts: 0
Joined: Thu Feb 16, 2012 5:15 pm

Saving state and data for user next use

Thanks Max, I'll have a play :)

New Mobile Guy
Posts: 0
Joined: Tue Jan 29, 2013 9:09 pm

Saving state and data for user next use

Can you clarify how exactly to save a variable or state to "local storage"? Is local storage something that's part of Tiggzi, or is this a jquery capability?

I need to be able to remember the user ID of the person who is using the app, so I can load in the right information from the backend data services.

Thanks!

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Saving state and data for user next use

Hello,

Local storage is a part of Tiggzi, this is for storing variables in your app.
For example, you can use actions to add local storage variable:
Image

I would also recommend you our docs http://docs.tiggzi.com

New Mobile Guy
Posts: 0
Joined: Tue Jan 29, 2013 9:09 pm

Saving state and data for user next use

Oh, ok. So to clarify, if the user leaves the app and comes back a week later, the value of that variable will be preserved? Or does it just save it during the current session?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Saving state and data for user next use

It will be saved in constant localStorage (this is a usual variable) - it is not RAM.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Saving state and data for user next use

Although Tiggzi builder provides a way to save data into local storage, actual local storage features is a standard browser feature. In the screen shot I posted, our builder allows saving data using the events wizard. However, you can use use the API directly from anywhere: codelocalStorage.setItem(value, name); localStorage.getItem(name); /code
More information on browser's local storage: https://developer.mozilla.org/en-US/d...

Return to “Issues”