Max length of alphaNumeric setting?

Hi,

Maybe I'm being daft, but I can't find the supported max length of an alphanumeric setting value anywhere in the docs!

Can anybody point me in the right direction?

From experiment, it looks to be about 22 characters, but I don't know if this is something that I can rely on.

Thanks,

Gaius

  • The lowest max is something like 256 characters, and that's based on what's used to set it - GCM, GE, the connect IQ app, etc.

    There are some apps that use long strings to define a "settings string",

    Other things come into play like the max size of all settings, which is about 8k.

    What is the max you assume for M2?

  • Not entirely related to the OP Question but I do want to know how these apps can take a setting string and then convert them to sometimhing the app can use to place things at specific locations and such. 

  • Hi Jim,

    If that is the case, why does the SDK settings manager block me inputting a long string?!

    The post came about because whenever I type more than a certain length, it displays my prompt string in red and refuses to save... thus I cannot develop / test anything realistic for my use case. 

    Is there something I need to set / specify in settingConfig node? Currently, it just has type=“alphaNumeric”.

    G

  • In your settings, you can define a max.  Her's one with a max of 32 characters and another with no limit.

            <setting propertyKey="@Properties.apikey2" title="@Strings.apikey">
                <settingConfig type="alphaNumeric" maxLength="32"/>
            </setting>
            <setting propertyKey="@Properties.hstation2" title="@Strings.hstation">
                <settingConfig type="alphaNumeric" />
            </setting>

    for apikey, the one with a max, it shows "invalid value", when I submit it with >32.

    for hstation, no issue with longs strings

    Do you have a max defined in your stting?

  • The max length I use for my settings is 255 - which is working so far as I know for all my users on the different apps etc

    I mainly decided on that length after reading these other 2 posts:

    Although reading those again it looks like 256 should be ok too ...

  • The way I did it for my first watchface my settings strings were like this format (numbers separated by commas):

    0,1,43,56,2,452,23,1,2,3,5,6, etc

    Each number means something - so "1" might mean draw the date, and the 2 numbers following this are the position to draw it at. So then you parse the 2 following numbers for x & y position. Then you read the next number, e.g. a "2", and maybe "2" means draw the time at the following 2 numbers, and then use the 3rd number as the color.

    So you can decide on the format you want all the numbers to represent. It's normally useful to have one of the numbers, e.g. the very first one, be a "version number", so that if you need to change the format in any way then you can change the version number and then the code can recognise which format the rest of the string will be in.

    Then for my next watchface, I still use a similar method, but I convert the list of numbers separated by commas into a more compressed format in order to make the strings shorter - which saves memory and also means you don't need to allow for such long strings (which can affect the number of settings if each string is limited to 256 characters) - but makes it much less readable.

    I convert each number to either 1 or 2 characters, and no longer need to have commas between them. I use my own system using the digits 0-9, and letters a-z and A-Z which allows one character to represent a value from 0 to 61. So using 2 characters you can represent a number up to 62*62-1 = 3843. (Although I actually use 1 bit in the first character to indicate if the value is encoded in 1 or 2 characters, so I only allow for numbers from 0 to 1921).

    I think these are some of the standard encoding systems: en.wikipedia.org/.../Binary-to-text_encoding

  • Well, it's been months, even years and the Documentation has no info about max length of alphaNumeric setting.

    Why is that so?

  • As stated earlier in this thread 255 should be safe, and after that it seems to depend on how you change app settings for  the app (GE,GCM, CIQ Mobile)

  • Thanks for reply Jim

    I don't wanna be rude or something :-D

    However, the question stays the same

    I expect Garmin to state what the length cap is..like numbers not "255 should be safe"..but why

    Don't get me wrong I don't see the reason why there is even some dif between Android & iOS (I think I read some info that max length differs for these), I even don't get the idea why GC (on mobile device) vs GE (on PC/Mac) vs CIQ should have such differences and nothing of this is described

    Of course, I can go thru my own trial&error and I'll pro'ly do that, however, that's just funny

    Reason why I ask is using a Json for "dynamic data", I miss something like subsections with a possibility to add more items right in the managing app (GE, GCM, CIQ). It adds a value in the way of letting users to extend e.g. watches (sub)menus with more usable data. Let's say, what if you wanna make watchface with some awsome settings and one of the settings' part is Timezones. I don't like loooong settings people make just to let people set this and that and each Drawable has its own part. What if you want to let the Watchface app add them somehow dynamically - the only way at the moment AFAIK is to the mighty Json. Well, it seem like dead-end street to me.

    I taky any advice, even off the top of your head

  • one thing is that using long (say 250 char) strings really isn't that common.  The max in any of mine is 32 chars (APIkeys).

    Using a long json string is difficult for the user, vs just selecting a color from a list, etc, even if there are 10 different colors that can be set.

    Also, in your app, you see a string, so your app is responsible to do any parsing, error checking etc.

    for fields where a time zone can be displayed, I have an associated field for -12 to 12 (Numbers and not Floats), and a Boolean if a 30 minute offset is to be used.