Checking the version of application which I am currently using in my app.

Checking the version is because we have to make the users to update the application so that there is no error when we change the scripts from the server.
Use:
try {
    PackageInfo pInfo = this.getPackageManager().getPackageInfo(getPackageName(), 0);
    String version = pInfo.versionName;
} catch (PackageManager.NameNotFoundException e) {
    e.printStackTrace();
}
And you can get the version code by using this
int verCode = pInfo.versionCode;


Comments

Popular posts from this blog

Styling Bottom Navigation

Lottie Animation in Android

Set Up the AWS Mobile SDK for Android