Page 1 of 1

Save User Preferences?

Posted: Thu Jun 04, 2015 6:58 pm
by Blair Cox

Silly question, but how can I save user preferences locally? For example, the user selects their language preference so every time the app opens, it is in their chosen language. It's one aspect that does not come up in searches online.


Save User Preferences?

Posted: Thu Jun 04, 2015 8:33 pm
by Serhii Kulibaba

Hello Blair,

Please use storage variables with Storage type="local storage" for it: https://devcenter.appery.io/documenta...


Save User Preferences?

Posted: Thu Jun 04, 2015 8:35 pm
by Blair Cox

Will it persist after the user closes the app? Some of the examples/tutorials show clearing local storage in order to work - eg. https://devcenter.appery.io/building-...


Save User Preferences?

Posted: Thu Jun 04, 2015 8:42 pm
by Blair Cox

I assume that in order to do this, I'll need to run some Javascript during onload, replacing the invoke service option. But I have no clue where to start writing the javascript for this.

Thanks,


Save User Preferences?

Posted: Thu Jun 04, 2015 11:53 pm
by Carlos7560851

All you seek is here:
https://devcenter.appery.io/documenta...

  1. Add storage variable in Project - Storage and Models

  2. Add input field in app UI,

  3. Add button to UI, this saves the input field (have this button when click add mapping to local storage)

  4. If you want to display the saved field in a input or retrieve anywhere else add event on load run javascript Apperyio('name_of_input_or_label').val(localStorage.getItem('name_of_local_storage_field'));

    And yes local storage saved even after closing App. This data is only deleted if the user deletes or removes the app entirely.

    Hope this helps.


Save User Preferences?

Posted: Fri Jun 05, 2015 1:23 am
by Blair Cox

Thanks Carlos!! :D you rock!!!