Windows 10
SDK: CIQ 3.0.7
Complete source code available upon request (*)
This is a problem that I've been wrestling with on multiple data field projects for a while now.
Sometimes when I send settings to a data field in the simulator and re-run the data field (because I don't handle onSettingsChanged), not only do the settings not get applied, but they also get reset to default.
This only happens in the simulator, not IRL.
EDIT: Now I have seen this happen IRL, with the same app (store version). I updated the app with two new booleans, and after I pushed settings, they were reset to default.
https://apps.garmin.com/en-US/apps/7...b-e97269c3cdb9
Sometimes there is a workaround where I can kill the app before sending settings, and it will work. Other times it seems like there is nothing I can do to push settings.
In the latter case I resort to hardcoding test settings in the properties XML, running the app and selecting "Reset App Data".
This is pretty frustrating and annoying, because my apps tend to have lots of settings <_< and I like testing them by changing them in the same way that the user would.
App notes:
- For compatibility across all watches, new and old, I am using Application.getApp().getProperty() to get settings
- I tend to have different settings for different targets (e.g. CIQ1 vs. CIQ2), in order to max out the capabilities of each platform
- I tend not to handle onSettingsChanged() (terrible practice, I know), because of the slight extra hit it might take in code that has to be smart enough to reinitialize certain things at run-time. In my defense, I've seen very popular apps that don't/can't handle onSettingsChanged(), and it's only really good for cosmetic changes anyway. If a metric type is changed in the middle of an activity, it may be literally impossible for the app to display that metric properly, since some metrics need to be calculated from the start.
(*) This has happened to me with so many apps, but I don't have a simple test case, I'm afraid. I do have complete source code for an app ("Lap+") where this has happened. It's source-controlled, so I'll be able to give you a usable copy of this at any time.
I wonder if having the different settings per-target "family" has something to do with it. However, I tried a very small test case and it doesn't to be that.
So maybe it's just having a large number of settings that's the problem.
Recreation procedure:
A)
- Open "Lap+" data field project in Eclipse. Complete source code available on request.
- Run app for FR935 in the simulator
- Open app settings
- Change "theme color" to dark green. (This is the easiest setting to change where you can see it didn't work.)
- Send settings to simulator
- Run app again.
- The actual theme color will be unchanged.
B)
- While app is still running, open app settings
- Kill the app (without closing the app settings or the simulator)
- Change the theme color to dark green
- Send settings to simulator
- Run app again
- The actual theme color will be changed to dark green
C)
- Now that the theme color has been changed, repeat A), except try to change the colour to dark blue (or anything but dark red, the default).
- The selected theme color will not be applied. As a matter of fact, when you run the app again, the theme color will be reset to the default (dark red).