code: public static boolean hasMetadata(@NonNull final Context context, @NonNull final String metadataKey) {
          if (TextUtils.isEmpty(metadataKey)) {
              throw new IllegalArgumentException("Meta data key can't be null or empty.");
          }
  
          try {
              final PackageInfo info = context.getPackageManager()
                      .getPackageInfo(context.getPackageName(), PackageManager.GET_META_DATA);
              final Bundle metaData = info.applicationInfo.metaData;
              if (metaData != null && metaData.get(metadataKey) != null) {
                  return true;
              }
          } catch (PackageManager.NameNotFoundException e) {
              //ignore
          }
          return false;
      }
docs: Checks if metadata is added in AndroidManifest.xml file.
  
  @param context     The instance of {@link android.content.Context}.
  @param metadataKey The checked metadata key.
  @return True if metadata is added, false otherwise.