How to get Package details?How to get Package details?

Get package versionCode and versionName as defined in manifest.xml file.
Example :
   

Answer 1

Get PackageManager refference to get android project package details.

    
 PackageManager manager = this.getPackageManager();

 try {
	  PackageInfo info = manager.getPackageInfo(this.getPackageName(), 0);
        Log.i(TAG, "VersionCode:"+info.versionCode +" VersionName:"+info.versionName);
     } 
   catch (NameNotFoundException e) 
     {
        Log.i(TAG, "NameNotFoundException caught: " + e.getMessage());
     }
   catch (Throwable t) 
     {
        Log.i(TAG,"Throwable caught: " + t.getMessage());
     }

SUBMIT YOUR ANSWER

  |  
 
 
 

Preview :