Entering negative numbers in settings on GCM (Android)

Entering a negative number in settings (for a Connect IQ app) on GCM using Android is 'kind of' broken. I know that this is an issue with GCM (and maybe should go into the GCM formum) but because it affects Connect IQ apps I'm hoping that the Garmin Connect IQ people (who tend to be on top of things around here) will raise the issue with the GCM group.

One of my settings (which I have configured as type 'number') for a data field is the magnetic variation (non-aviation folks more often call it magnetic declination). In Calgary, our current variation is 15°E, which is fine because you would enter that as "15". But if the variation was 15°W then the user would enter "-15". However, in order to enter a negative number on GCM (at least on Android), you can't simple type "-15" because the input code only seems to allow the minus sign once there is a number. So you need to enter the "15" first, then go back and add the minus sign to the front. I consider myself to have above average technical savvy but I only just discovered this, and only after I'd coded a workaround to handle the fact that users are most likely to say "WTF???".

Is this an issue with iPhone GCM also? And more importantly, is this issue in the pipeline to be fixed?

Cheers,
Douglas
  • Hi,
    I'm certainly not on top of things here ;)
    ... but here how I solved this issue:

    instead of using type number in the resources.xml file I used

    <settingConfig type="alphaNumeric"/>

    and then in the code I convert this to number

    ...
    if (utcdiff instanceof Lang.String)

    {utcdiff = utcdiff.toNumber();} ...

    Might not be the best solution, but it works for me.

    Cheers
  • Hi,
    I'm certainly not on top of things here ;)
    ... but here how I solved this issue:

    instead of using type number in the resources.xml file I used

    <settingConfig type="alphaNumeric"/>

    Might not be the best solution, but it works for me.


    Are you using/testing against Android also? Do we know if this also affects iPhone?

    Regardless, I thought of that but didn't want to have to deal with non-numeric characters and handling the cases where alpha characters are input. I solved it by keeping the numeric configuration and then adding another configuration/setting for the hemisphere (east, west or none) and then treat the variation accordingly.

    Cheers,
    Douglas
  • Are you using/testing against Android also? Do we know if this also affects iPhone?

    Regardless, I thought of that but didn't want to have to deal with non-numeric characters and handling the cases where alpha characters are input. I solved it by keeping the numeric configuration and thenadding another configuration/setting for the hemisphere (east, west or none) and then treat the variation accordingly.

    Cheers,
    Douglas


    Yes, I use and test Android, only.
    In my code I also test for the input range:
    something like this:


    if(utcdiff instanceof Lang.String)
    {
    if (utcdiff.equals("-12") or utcdiff.equals("-11") or ...
    {utcdiff = utcdiff.toNumber();}
    else {utcdiff=0;}
    }

    So If the user will set something out of this input range, or set a non-numeric character then the default value for utcdiff will be 0.

    But I like your solution for this given application and my description might only be of "academic" value for you ;)