code: protected static String getApplicationName(Context ctx) {
          try {
              ApplicationInfo applicationInfo = ctx.getApplicationInfo();
              int stringId = applicationInfo.labelRes;
              if (stringId == 0) {
                  if (applicationInfo.nonLocalizedLabel != null) {
                      return applicationInfo.nonLocalizedLabel.toString();
                  }
              } else {
                  return ctx.getString(stringId);
              }
          } catch (Exception e) {
              Log.e(TAG, "Error getting application name.", e);
          }
  
          return null;
      }
docs: Get the human-facing Application name.
  
  @param ctx Android application context
  @return Application name