code: @Nullable
      public static List<Uri> onResult(@NonNull Context context, int resultCode,
              @Nullable Intent data) {
          if (resultCode != Activity.RESULT_OK || data == null) {
              return null;
          }
  
          ClipData clip = null;
  
          if (Build.VERSION.SDK_INT >= 18) {
              clip = data.getClipData();
          }
  
          final List<Uri> uris;
  
          if (clip != null) {
              uris = new ArrayList<>();
              for (int i = 0, size = clip.getItemCount(); i < size; i++) {
                  uris.add(clip.getItemAt(i).getUri());
              }
          } else if (data.getData() != null) {
              uris = Collections.singletonList(data.getData());
          } else {
              uris = Collections.emptyList();
          }
  
          // Trying to get persistable read permissions
          if (Build.VERSION.SDK_INT >= 19) {
              final int readFlag = Intent.FLAG_GRANT_READ_URI_PERMISSION;
              if ((data.getFlags() & readFlag) == readFlag) {
                  for (Uri uri : uris) {
                      try {
                          context.getContentResolver().takePersistableUriPermission(uri, readFlag);
                      } catch (Exception ignored) {
                          // Persistable permission was not granted, ignoring
                      }
                  }
              }
          }
  
          return uris;
      }
docs: Call this method from {@link Activity#onActivityResult(int, int, Intent)} method to
  get picked contact info.