Need help using setting after being set in Garmin Connect Mobile

Former Member
Former Member
Ok .. well this has been a battle for a month and I know I am not the only one facing this problem. This is for the Vivoactive HR.

The error is as below.

ERROR: Unexpected Type Error
DETAILS: Failed invoking <symbol>
STORE_ID: 30a9d68d515b4d72a97ca13691762a8c
CALLSTACK:
@PC = 0x00000000
  • When you read the property:

    rhr_prod = Application.getApp().getProperty("RHR");

    you probably want to check if it's the type you expect. For example, if what you get is a String, you'd get the error you see. It would display fine, but the compare would cause the error.

    if(rhr_prod instanceof Number) {

    }

    If it's not a number (maybe it's a string) do

    hrh_prod=rhr_prod.toNumber()
  • Former Member
    Former Member over 8 years ago
    When you read the property:

    rhr_prod = Application.getApp().getProperty("RHR");

    you probably want to check if it's the type you expect. For example, if what you get is a String, you'd get the error you see. It would display fine, but the compare would cause the error.

    if(rhr_prod instanceof Number) {

    }

    If it's not a number (maybe it's a string) do

    hrh_prod=rhr_prod.toNumber()



    I do the following ..

    rhr_value = Application.getApp().getProperty("RHR");

    if(rhr_value == null)
    {
    rhr_value = 0;
    }

    if(rhr_value!= null && !(rhr_value instanceof Number))
    {
    rhr_value = rhr_value.toNumber();
    }

    if(rhr_value!= null && (rhr_value instanceof String))
    {
    rhr_value = 0;
    }

    The moment that I do that comparison .. I get the error. I have determined that it is a number.
  • Are you sure you're getting the error on the line you indicate and not somewhere else? Or maybe something else on that line?
  • Former Member
    Former Member over 8 years ago
    Are you sure you're getting the error on the line you indicate and not somewhere else?


    Doh .. I lied. See below.
  • Former Member
    Former Member over 8 years ago
    - deleted -
  • Former Member
    Former Member over 8 years ago
    I wanted to make an update ..

    I have determined that there is nothing wrong with Garmin Connect Mobile and the setting of user settings and the VAHR, at least when it is concerning numbers. This was with VAHR firmware version 2.65 beta and SDK 1.2.9 with a watch face in the Garmin Connect IQ store.

    I determined that GCM returns a NUMBER .. exactly as expected, and NO errors received. I updated the value of that number on the GCM screen and also did a comparison of another number to confirm that a comparison works. This was in GCM for iOS.

    My code is below. I think this covers the issue of GCM not returning what is expected. That is not the case in my testing. I consistently got "IT IS A NUMBER" as I expected and was able to change the setting and got the expected lower / higher results as I changed the user setting.

    rhr_value = Application.getApp().getProperty("RHR");

    if(rhr_value == null)
    {
    rhr_value = 0;
    System.println("IT IS NULL");
    }

    if(rhr_value!= null && !(rhr_value instanceof Number))
    {
    rhr_value = rhr_value.toNumber();
    System.println("IT IS NOT A NUMBER");
    }

    if(rhr_value!= null && (rhr_value instanceof String))
    {
    rhr_value = 0;
    System.println("IT IS A STRING");
    }

    if(rhr_value!= null && (rhr_value instanceof Number))
    {
    System.println("IT IS A NUMBER");
    }

    dc.drawText(130,60,Gfx.FONT_LARGE,"SETTING " + rhr_value.toString(), Gfx.TEXT_JUSTIFY_RIGHT);

    if(rhr_value > 100)
    {
    dc.drawText(130,100,Gfx.FONT_LARGE,"GREATER", Gfx.TEXT_JUSTIFY_RIGHT);
    }
    else
    {
    dc.drawText(130,100,Gfx.FONT_LARGE,"LOWER", Gfx.TEXT_JUSTIFY_RIGHT);
    }