Esempio n. 1
0
 /**
  * @param context
  * @return
  */
 public static String version(final Context context) {
   String version = null;
   try {
     final PackageInfo packageinfo =
         context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
     version = packageinfo.versionName;
   } catch (Exception x) {
     DBG.m(x);
   }
   return version;
 }
Esempio n. 2
0
 /**
  * @param context
  * @return
  */
 public static String getApplicationName(final Context context) {
   String name = null;
   try {
     final PackageManager packagemanager = context.getPackageManager();
     final PackageInfo packageinfo = packagemanager.getPackageInfo(context.getPackageName(), 0);
     name =
         packageinfo.applicationInfo.loadLabel(packagemanager).toString()
             + "("
             + packageinfo.packageName
             + ")";
   } catch (Exception x) {
     DBG.m(x);
   }
   return name;
 }