I am building a multi-app project in Android Studio and use Gradle for my versioning.
I use
versionName "1.0"
versionCode 2
versionNameSuffix = ".alpha1"
I also use
def getDate() {
new Date().format('yyyyMMddHHmmss')
}
and
buildConfigField 'String', 'BUILD_DATE', '\"' + getDate() + '\"'
and all works well.
I can access those though code using
String vN = BuildConfig.versionName;
int vC = BuildConfig.versionCode;
String bD = BuildConfig.BUILD_DATE;
One problem I am having is that I sometimes need to access this information from another application.
I can get versionName and versionCode with
PackageInfo pi = this.getPackageManager().getPackageInfo(packageName, 0);
String vN = pi.versionName;
int vC = pi.versionCode;
is there any way to access BUILD_DATE from another app?