Show full version name based upon git describe --tags on startup and also in AboutActivity.

This commit is contained in:
Dennis Guse
2019-09-02 16:05:24 +02:00
parent 72b1ca82ed
commit c551a38a8b
3 changed files with 4 additions and 3 deletions
+2 -1
View File
@@ -52,7 +52,8 @@ android {
applicationId "de.dennisguse.opentracks"
//Useful for debugging.
//versionCode getVersionCode()
//versionName getVersionName()
buildConfigField "String", "VERSION_NAME_FULL", "\"${getVersionName()}\""
minSdkVersion 21
targetSdkVersion 29
@@ -15,7 +15,7 @@ public class Startup extends Application {
super.onCreate();
//Include version information into stack traces.
Log.i(TAG, BuildConfig.APPLICATION_ID + "; BuildType: " + BuildConfig.BUILD_TYPE + "; VersionName: " + BuildConfig.VERSION_NAME + " VersionCode: " + BuildConfig.VERSION_CODE);
Log.i(TAG, BuildConfig.APPLICATION_ID + "; BuildType: " + BuildConfig.BUILD_TYPE + "; VersionName: " + BuildConfig.VERSION_NAME + "/" + BuildConfig.VERSION_NAME_FULL + " VersionCode: " + BuildConfig.VERSION_CODE);
//Set default values of preferences on first start.
PreferencesUtils.resetPreferences(this, false);
@@ -49,7 +49,7 @@ public class SystemUtils {
public static String getAppVersionName(Context context) {
try {
PackageInfo pi = context.getPackageManager().getPackageInfo(BuildConfig.APPLICATION_ID, PackageManager.GET_META_DATA);
return pi.versionName;
return pi.versionName + "/" + BuildConfig.VERSION_NAME_FULL;
} catch (NameNotFoundException e) {
Log.w(TAG, "Failed to get version info.", e);
return "";