What is the best approach for a build constant that I want to display in settings?

Hi,

So I would like to be able to display the version number of my software in settings. EG:

"Software version: 1.0.0, compiled on X-Y-Z"

I am aware that the manifest version number is not available in the SDK, so I have a script that writes the value as a resource and updates it with every build.

So far, so good...

BUT... then I need to find a way to display it to the user.

I _could_ set it as a property, but that would be retained between builds as Garmin would see it as a user preference. So that won't work.

I _could_ set it as a string and use the string as a label in settings, but then I need to localise the version string in my build scripts and... well that's harder.

Is there a better way to display content in settings menu that is CONSTANT (as regards the user) but VARIABLE for each new build?

G

  • You'd do it by writing a property set to read only in the settings.xml if I recall.

    The thing you run into is that doesn't get updated until the app is run on the device, so until the user runs the app on the device, it will show the wrong version in app settings.

    Where I display a version number, it's just a string in my code and I display it when the app runs.

  • Another thing, is when you install an app from the store, you can easily see the current version number in the store with GCM, the Connect IQ app or Garmin Express, and with the Connect IQ app, a user can set it to automatically update an app if there's a newer version.  Same with Garmin Express.

    You may find that just having the store version number is enough.

  • It's one of those things that is theoretically achievable, but not intuitive for a user! This is in response to a user request.

    G

  • As per the other thread, I strongly advise against a non-essential write to properties!

    Devours memory like you would not believe [er... actually, you would as it was your input to another thread that made me discover this...].

    But... still... definitely good practice to avoid writing to properties unless it is absolutely unavoidable if you are in any way concerned about peak memory.

    I think I'll go with the compiled string modified by build script.

    Another thing, is when you install an app from the store, you can easily see the current version number in the store with GCM, the Connect IQ app or Garmin Express, and with the Connect IQ app,

    Because... although you are sort of correct, there is always the potential for difference between the version listed in GCM and the actual version that is currently installed. Especially where updates are either not automatic or not successful.

  • If you want the safest way to display the version of installed app, do the display in the app itself and not by way of settings.

    You may also find that when the app is stable, you don't really update it that often so the version rarely changes - only when adding a new device or something like a minor bug fix

  • I see no problem to get version from strings resources. Correct me if I am wrong.

    something like 

    <string id="appVersion">1.4.1</string>

  • It's fine to get it that way, I was talking about how you display it and where.