Android examples for App:APK Information
get Apk Version Code
//package com.java2s; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; public class Main { public static int getApkVersionCode(Context context, String apkPath) { if (context == null || apkPath == null) { return -1; }// w w w . jav a 2s. com PackageManager pm = context.getPackageManager(); PackageInfo info = pm.getPackageArchiveInfo(apkPath, PackageManager.GET_ACTIVITIES); if (info != null) { ApplicationInfo appInfo = info.applicationInfo; return info.versionCode; } return -1; } }