code: static String getAppVersion(Context context) {
          String appVersion = "";
          if (context != null) {
              try {
                  final PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
                  appVersion = packageInfo.versionName;
              } catch (Exception e) {
                  PrefHelper.LogException("Error obtaining AppVersion", e);
              }
          }
          return (TextUtils.isEmpty(appVersion) ? BLANK : appVersion);
      }
docs: Get the App Version Name of the current application that the SDK is integrated with.
  @param context Context.
  @return {@link String} value containing the full package name.  BLANK in case of error