List of utility methods to do APK Version Get
String | getAPKVersion(Context context) get APK Version String APKVersion = ""; PackageManager pm = context.getPackageManager(); String packageName = context.getPackageName(); PackageInfo info = null; try { info = pm.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES); } catch (NameNotFoundException e) { ... |
String | getAppVer(Context context) get App Ver try { PackageInfo packageInfo = context.getPackageManager() .getPackageInfo(context.getPackageName(), 0); return packageInfo.versionName + "(" + packageInfo.versionCode + ")"; } catch (Throwable e) { Logger.w("getPackageInfo failed", e); return ""; ... |
int | getAppVersionCode(Context context) get App Version Code int versionCode = 0; try { PackageManager pm = context.getPackageManager(); PackageInfo pi = pm.getPackageInfo(context.getPackageName(), 0); versionCode = pi.versionCode; } catch (Exception e) { FrameworkLog.e(TAG, "getAppVersionCode Exception: " + e.getMessage()); ... |
int | getAppVersionCode(Context context) Returns version code of OpenSudoku. try { return context.getPackageManager().getPackageInfo( context.getPackageName(), 0).versionCode; } catch (NameNotFoundException e) { throw new RuntimeException(e); |
String | getAppVersionName(Context context) Returns version name of OpenSudoku. try { return context.getPackageManager().getPackageInfo( context.getPackageName(), 0).versionName; } catch (NameNotFoundException e) { throw new RuntimeException(e); |
String | getAppVersionName(Context context, String defVersion) get App Version Name String versionName = defVersion; try { PackageManager pm = context.getPackageManager(); PackageInfo pi = pm.getPackageInfo(context.getPackageName(), 0); versionName = pi.versionName; if (versionName == null || versionName.length() <= 0) { return defVersion; } catch (Exception e) { FrameworkLog.e(TAG, "getAppVersionName Exception: " + e.getMessage()); return versionName; |
String | getApplicationVersion(Context ctx) Returns the application version from manifest file String version = null; try { PackageInfo info = ctx.getPackageManager().getPackageInfo( ctx.getPackageName(), 0); version = info.versionName; } catch (NameNotFoundException e) { return version; ... |
long | getFirstInstalled() get First Installed long firstInstalled = 0; PackageManager pm = myApp.getPackageManager(); try { PackageInfo pi = pm.getPackageInfo(myApp .getApplicationContext().getPackageName(), pm.GET_SIGNATURES); try { try { ... |
String | getVersion(Context context) get Version try { PackageInfo pInfo = context.getPackageManager().getPackageInfo( context.getPackageName(), 0); return pInfo.versionName + " :: " + pInfo.versionCode; } catch (PackageManager.NameNotFoundException e) { return "unknown"; |
String | getVersionCode(Context context) get Version Code try { PackageInfo pInfo = context.getPackageManager().getPackageInfo( context.getPackageName(), 0); return "" + pInfo.versionCode; } catch (PackageManager.NameNotFoundException e) { return "unknown"; |