code: public static Uri getTargetUrl(Intent intent) {
      Bundle appLinkData = getAppLinkData(intent);
      if (appLinkData != null) {
        String targetString = appLinkData.getString(KEY_NAME_TARGET);
        if (targetString != null) {
          return Uri.parse(targetString);
        }
      }
      return intent.getData();
    }
docs: Gets the target URL for an intent, regardless of whether the intent is from an App Link. If the
  intent is from an App Link, this will be the App Link target. Otherwise, it will be the data
  Uri from the intent itself.
  
  @param intent the incoming intent.
  @return the target URL for the intent.