Settings values consistency issue (6.80)

Former Member
Former Member
Guys, am I the only one facing issues with my watch face getting correct settings values? They are jumping like crazy, especially when you set settings via the phone (Android in my case) and Garmin Connect (Windows). The main issue is that values, except the ones which where changes, are dropping to defaults. I'm using safest and redundant way to get properties:
function getNumberProperty(app, key, initial) {
var value = app.getProperty(key);
if (value != null) {

if (value instanceof Lang.Number) {
return value;
}
else if (value instanceof Lang.String) {
return value.toNumber();
}
}

return initial;
}

Can anybody confirm this issue?
Thanks!

P.S. IQ: v.1.2.2; Firmware: v.6.80
  • The current GCM/Andriod seems to at times return what you expect to be a number as a float. Where you check for "instanceof String", you want to change it so that it also works for floats.

    Note, very large number may loose some precision if that occurs (that's just how floats work...).
  • Former Member
    Former Member over 9 years ago
    The current GCM/Andriod seems to at times return what you expect to be a number as a float. Where you check for "instanceof String", you want to change it so that it also works for floats.

    Note, very large number may loose some precision if that occurs (that's just how floats work...).


    It seems like you are absolutely correct! Thanks bro, you saved me!
    Was it introduced with latest updates or before? Was it reflected anywhere (change log)?
  • I first saw it in GCM/A 3.3, and I think it's a bug with GCM/A. I have let Garmin know about this.
  • I've updated the post where that code was taken from. I'll try to keep it up to date.

    Travis
  • Former Member
    Former Member over 9 years ago
    I've updated the post where that code was taken from. I'll try to keep it up to date.

    Travis


    Correct, the code is from this thread. Used it when I was desperate to again solve weird issues with settings. Now I'm using next function and it works fine:
    function getNumberProperty(app, key, initial) {
    var value = app.getProperty(key);
    return value != null ? value.toNumber() : initial;
    }
  • function checkInput(app,input) {
    var val = app.getProperty(input);
    if ( val != null && !val.equals("")) {
    return val;
    }
    return "999";
    }


    this is what I am using currently in SOME of my projects.
    I really would like to remove this code to save memory honestly...

    16kB is not much to begin with and once we reach 14+kb, it's like jumping over the cliff.