code: protected static PackageInfo getPackageInfo(Context ctx) {
          try {
              return ctx.getPackageManager().getPackageInfo(ctx.getPackageName(), 0);
          } catch (PackageManager.NameNotFoundException e) {
              Log.e(TAG, "Error getting package info.", e);
              return null;
          }
      }
docs: Return the Application's PackageInfo if possible, or null.
  
  @param ctx Android application context
  @return the Application's PackageInfo if possible, or null