Overwrite User Settings in app

Hi,
I'm wondering if it's possible to modify User Settings from within the app?


Like: app.setProperty("userSetting1", updatedValue);

I tried it but it doesn't seem to be saved when closing the app. Did anyone manage that?
  • This should work as long as the property you're modifying is already a defined setting. So in your case, is the setting getting properly modified while the app is running but is not being written out to the SET file when the app is closed?
  • Hi Brandon,

    Thanks for the reply. After testing on the watch (D2 Bravo), it actually works. Data are saved via setProperty(), and they can be accessed again using getProperty().
    The reason I said it did not work is that I tested it on the simulator, and that didn't work.
  • The trick to make sure things are saved in the simulator (at least for the Object Store properties) is to Ctrl-K the simulator ("kill" the app)
  • I'm fairly certain that I've had problems with this recently as well. It seems to me that killing the simulator session with CTRL+K doesn't work or is inconsistent. The one thing that does seem to work is to call Ui.popView() on the main view (in the simulator). You don't want to do this for widgets when running on a device though.
  • Post back here if you can find a way to reliably reproduce the simulator issue. I'll report it as something that needs investigation in the meantime.
  • ctrl-k works relatively well for me. The only thing I've faced is if I used the same PRG file name, it would conflict and then I'll have to go to the connectIQ folder and delete the garmin directory and start fresh.

    But then, that's my laziness to us the same PRG name. (Up arrow key to retrieve last command issued is simpler. Lol..)