Home > DeveloperSection > Forums > How to get and set version name in Andriod
Royce Roy
Royce Roy

Total Post:134

Points:938
Posted on    February-13-2015 12:43 AM

 Android Android 
Ratings:


 1 Reply(s)
 633  View(s)
Rate this:
How to get and set version name in Andriod?


ben reitman
ben reitman

Total Post:96

Points:676
Supported
Posted on    February-13-2015 5:21 AM

Get Version Name

// Package Info keep your project information

            PackageInfo pInfo = getPackageManager().getPackageInfo(

                      getPackageName(), 0);

// return version Name in String

             String version = pInfo.versionName;


Set Version Name

  1. 1. Expand your Project.
  2. 2. Open Manifest file




Before

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

    package="com.mindstick.demoapplication"

    android:versionCode="1"

    android:versionName="1.0" >


After

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

    package="com.mindstick.demoapplication"

    android:versionCode="2"

    android:versionName="1.2" >


Don't want to miss updates? Please click the below button!

Follow MindStick