Application properties are being lost when a widget is opened

Former Member
Former Member
Hi,
I have the following feedback on my widget:
"No longer works with software update v5.0. Site name in settings gets deleted continually requiring you re-enter it everytime you use the widget on fenix 3"

What the widget does is it goes and gets a json feed from the user's personal website. The sitename is set using a menu item and a textpicker for watches like the Fenix, or a hardcoded menu for us poor souls with a Vivoactive.

The widget then uses getJsonRequest to receive some data which it then displays. I am struggling to debug it and find out what the real issue is because:
1. I can't update my watch to the latest firmware because Garmin Express won't install.
2. I can't test the widget in the simulator on version 1.2.1 because getJsonRequest doesn't work.
3. I don't have a Fenix 3 (can I have a free one, please)
4. It seems to work OK in v1.2.0 and v1.1.4

I set the properties in a couple of ways in my code, but I don't use the settings function which seems like it might be coming with v1.2.x

I first set them if they are null when my app initialises:
// if the hostdomain or sitename properties are null set them to a default
if (apprun.getProperty("hostdomain") == null) {
setProperty("hostdomain", ".mydomainname.net");
}

if (apprun.getProperty("sitename") == null) {
setProperty("sitename", "mysitename");
}

I use the setProperty function to set them when the user does the right things in the menus as well.

The way the app behaves is that it concatenates the sitename and domain and then makes the json call.

When you exit the widget the properties persist until the next time you use it. Which means that it remembers your website.

Has something changed with property setting that means it now forgets or have I missed something else?

https://apps.garmin.com/en-GB/apps/00bde42c-44b6-474e-975c-7c593c6a3bcb

Many thanks,
R.
  • Former Member
    Former Member over 9 years ago
    Now fixed

    Hi,
    I have the following feedback on my widget:
    "No longer works with software update v5.0. Site name in settings gets deleted continually requiring you re-enter it everytime you use the widget on fenix 3"

    What the widget does is it goes and gets a json feed from the user's personal website. The sitename is set using a menu item and a textpicker for watches like the Fenix, or a hardcoded menu for us poor souls with a Vivoactive.

    The widget then uses getJsonRequest to receive some data which it then displays. I am struggling to debug it and find out what the real issue is because:
    1. I can't update my watch to the latest firmware because Garmin Express won't install.
    2. I can't test the widget in the simulator on version 1.2.1 because getJsonRequest doesn't work.
    3. I don't have a Fenix 3 (can I have a free one, please)
    4. It seems to work OK in v1.2.0 and v1.1.4

    I set the properties in a couple of ways in my code, but I don't use the settings function which seems like it might be coming with v1.2.x

    I first set them if they are null when my app initialises:
    // if the hostdomain or sitename properties are null set them to a default
    if (apprun.getProperty("hostdomain") == null) {
    setProperty("hostdomain", ".mydomainname.net");
    }

    if (apprun.getProperty("sitename") == null) {
    setProperty("sitename", "mysitename");
    }

    I use the setProperty function to set them when the user does the right things in the menus as well.

    The way the app behaves is that it concatenates the sitename and domain and then makes the json call.

    When you exit the widget the properties persist until the next time you use it. Which means that it remembers your website.

    Has something changed with property setting that means it now forgets or have I missed something else?

    https://apps.garmin.com/en-GB/apps/00bde42c-44b6-474e-975c-7c593c6a3bcb

    Many thanks,
    R.


    So, I have fixed this. The answer to the json request issue is that you need to explicitly set the parameters to null and not pass in {}. This will work on 1.2.1 and will work on watches running v1.1.x

    The answer to the settings issue was I made a number of changes including:
    Adding resources for properties and settings
    change the property initialisation if clause to if (null == apprun.getProperty("sitename"))

    I don't know which fixed it, but the problem has gone away.