Blair Cox
Posts: 0
Joined: Thu Jun 04, 2015 2:29 pm

Save User Preferences?

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.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Save User Preferences?

Hello Blair,

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

Blair Cox
Posts: 0
Joined: Thu Jun 04, 2015 2:29 pm

Save User Preferences?

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-...

Blair Cox
Posts: 0
Joined: Thu Jun 04, 2015 2:29 pm

Save User Preferences?

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,

Carlos7560851
Posts: 0
Joined: Fri May 29, 2015 8:46 pm

Save User Preferences?

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.

Blair Cox
Posts: 0
Joined: Thu Jun 04, 2015 2:29 pm

Save User Preferences?

Thanks Carlos!! :D you rock!!!

Return to “Issues”