fun newCustomAudienceThirdPartyIdRequest()

in facebook-core/src/main/java/com/facebook/GraphRequest.kt [612:654]


    fun newCustomAudienceThirdPartyIdRequest(
        accessToken: AccessToken?,
        context: Context,
        applicationId: String?,
        callback: Callback?
    ): GraphRequest {
      var applicationId = applicationId
      if (applicationId == null && accessToken != null) {
        applicationId = accessToken.applicationId
      }
      if (applicationId == null) {
        applicationId = getMetadataApplicationId(context)
      }
      if (applicationId == null) {
        throw FacebookException("Facebook App ID cannot be determined")
      }
      val endpoint = "$applicationId/custom_audience_third_party_id"
      val attributionIdentifiers = getAttributionIdentifiers(context)
      val parameters = Bundle()
      if (accessToken == null) {
        if (attributionIdentifiers == null) {
          throw FacebookException(
              "There is no access token and attribution identifiers could not be " + "retrieved")
        }

        // Only use the attributionID if we don't have an access token.  If we do, then the user
        // token will be used to identify the user, and is more reliable than the attributionID.
        val udid =
            if (attributionIdentifiers.attributionId != null) attributionIdentifiers.attributionId
            else attributionIdentifiers.androidAdvertiserId
        if (attributionIdentifiers.attributionId != null) {
          parameters.putString("udid", udid)
        }
      }

      // Server will choose to not provide the App User ID in the event that event usage has been
      // limited for this user for this app.
      if (FacebookSdk.getLimitEventAndDataUsage(context) ||
          attributionIdentifiers != null && attributionIdentifiers.isTrackingLimited) {
        parameters.putString("limit_event_usage", "1")
      }
      return GraphRequest(accessToken, endpoint, parameters, HttpMethod.GET, callback)
    }