Display version in UI

Hello!

I trying display the version of APP in launchscreen, ¿how do it do?

Can i get the version of App.info?

Thanks!

I save the version of my application in the Meteor settings JSON. This way you can easily access it from within a meteor project.

I wrote a script that will:

  • get the current settings JSON from my host
  • set the version to whatever I’m pushing
  • push the JSON file to my host
  • push the latest commit to the host git remote

Perhaps something similar can work for you?

I do something similar, I think, except since I like to keep my Meteor settings JSON minimal (opting for env vars when possible) I store the version information as an export in /imports/Version.js, where I also keep my public-facing release notes. Anywhere I need the version number I just import that file. Something like:

const Version = {
  current: '12.6.1',
  history: [/* ... */],
};

I wrote a git hook to check for changes to the version number (current: '___') and automatically apply a git tag to the commit that matches the version number. Pasting below in case anyone would like to adapt it:

#!/bin/bash

version=`git diff HEAD^..HEAD -- "$(git rev-parse --show-toplevel)"/imports/Version.js | grep '^\+.*current:\s*' | cut -d"'" -f2`

if [ "$version" != "" ]; then
  git tag -a "v$version" -m "`git log -1 --format=%s`"
  echo "Created a new tag, v$version"
fi
``

If your version is stored in package.json, you can access it like this

import { version } from '/package.json';

So you can use this import in a server method

4 Likes

Thank you for your answers. I will try to implement some of your options.

I’m no longer using cordova but I remember there is no way to add text to the cordova launchscreens. Only images for both android and ios