public static
String getAppVersionName(Context mContext, Class cls) {
try
{
ComponentName comp = new ComponentName(mContext, cls);
PackageInfo pinfo = mContext.getPackageManager().getPackageInfo(comp.getPackageName(),
0);
return "Version: " + pinfo.versionName;
} catch
(Exception e) {
return null;
}
}
No comments:
Post a Comment