-
public final class AppsFlyerApiServiceHigh-level façade over the SDK's backend API surface (feature F-013). Each method assembles a Request for one endpoint — building the URL via EventUrlResolver/UrlProvider, encrypting or signing the payload as required, attaching headers — and turns it into a runnable Call through ApiCallFactory. This is the single place where endpoint wiring lives; the actual transport is done later by
HttpClientwhen the returned Call is executed by a queue Task.Cross-cutting behavior:
Encryption — payloads sent to event/purchase endpoints are encrypted by
AFFinalizer(features F-017 / F-066); OneLink requests are sent in clear text by design.HMAC signing — OneLink create/resolve requests are signed via generateOneLinkSignature (feature F-016).
Security headers — checksum/device-farm headers are added for eligible events (feature F-028) by addSecurityHeadersIfNeeded.
HTTP cache — disabled per the
HTTP_CACHEmanifest flag (RD-48694), applied centrally in createCall.
Methods that build an encrypted payload return a nullableCall: a
nullresult means the payload could not be prepared (e.g.AFFinalizerreflection failure) and the caller must skip the send rather than dispatch an empty request.
-
-
Field Summary
Fields Modifier and Type Field Description private final Map<String, Object>oneLinkMeta
-
Constructor Summary
Constructors Constructor Description AppsFlyerApiService(ApiCallFactory callFactory, IdProvider idProvider, UrlProvider urlProvider, EventUrlResolver eventUrlResolver, PluginDetailsProvider pluginDetailsProvider, SecureDataProvider secureDataProvider)
-
Method Summary
Modifier and Type Method Description final Map<String, Object>getOneLinkMeta()final Call<String>arsValidateSubscription(Map<String, Object> requestData, String devKey)Builds the encrypted Auto-Renewable Subscription (ARS) validation request (feature F-070). final Call<String>sendInAppPurchaseRequest(Map<String, Object> requestData, String devKey)Builds the encrypted in-app purchase validation (VIAP) request (feature F-069). final Call<String>sendManualOneTimePurchaseValidationRequest(Map<String, Object> requestData, String devKey)Builds the encrypted manual one-time purchase validation request (feature F-069), used when the app validates a purchase through the manual API rather than the auto-logging path. final Call<String>sendManualSubscriptionPurchaseValidationRequest(Map<String, Object> requestData, String devKey)Builds the encrypted manual subscription validation request (feature F-069), the manual-API counterpart of the auto-renewable subscription flow. final Call<RemoteConfiguration>fetchRemoteConfiguration(Boolean isSandbox, Boolean isStaging, String cdnToken, Integer timeoutMillis)Builds the (unencrypted) remote-configuration fetch from the CDN. final Call<String>sendAppsFlyerEvent(AFEvent event, String devKey, ContextProvider contextProvider)Builds the request for a generic AFEvent (session, in-app, ad-revenue, etc.) — the main event-sending endpoint. final Call<DdlResponse>sendDdlEvent(DdlEvent event)Builds the Deferred Deep Link (DDL) request. final Call<Map<String, Object>>sendGcdRequest(String channelPostfix, String devKey)Builds the Get-Conversion-Data (GCD) request (feature F-073). final Call<String>sendCachedEvent(CachedEvent event)Builds the request for a CachedEvent — an event previously persisted to disk and resent on a later launch. final Call<String>createOneLink(String oneLinkId, Map<String, String> data, String brandDomain, UUID uuid, String devKey)Builds a create-OneLink request (feature F-109) for the oneLinkId template. final Call<Map<String, String>>resolveOneLink(String oneLinkId, String shortLinkId, UUID uuid, String devKey)Builds a resolve-OneLink request used by Unified Deep Linking (feature F-093) to expand the shortLinkId under the oneLinkId template into its link parameters. final Call<String>crossPromoteImpression(String url)Builds a cross-promotion impression request for the given url. final UploadRemoteDebugRequestcreateRdRequest(Map<String, Object> proxyData, String devKey)Unlike the other APIs in this class, this method does not use ApiCallFactory nor return a Call: the HTTP request is not executed via the queue but by an UploadRemoteDebugRequest running on a background executor. -
-
Constructor Detail
-
AppsFlyerApiService
AppsFlyerApiService(ApiCallFactory callFactory, IdProvider idProvider, UrlProvider urlProvider, EventUrlResolver eventUrlResolver, PluginDetailsProvider pluginDetailsProvider, SecureDataProvider secureDataProvider)
- Parameters:
callFactory- turns a prepared Request + ResponseConverter into a Call.idProvider- device/app identifiers and manifest flag lookups.urlProvider- resolves remote-configuration (CDN) URLs.eventUrlResolver- resolves per-endpoint URLs (events, ARS/VIAP, OneLink, GCD, …).pluginDetailsProvider- current wrapper/plugin name for OneLink metadata.secureDataProvider- generates checksum/SBID security data for eligible events.
-
-
Method Detail
-
getOneLinkMeta
final Map<String, Object> getOneLinkMeta()
-
arsValidateSubscription
final Call<String> arsValidateSubscription(Map<String, Object> requestData, String devKey)
Builds the encrypted Auto-Renewable Subscription (ARS) validation request (feature F-070).
-
sendInAppPurchaseRequest
final Call<String> sendInAppPurchaseRequest(Map<String, Object> requestData, String devKey)
Builds the encrypted in-app purchase validation (VIAP) request (feature F-069).
-
sendManualOneTimePurchaseValidationRequest
final Call<String> sendManualOneTimePurchaseValidationRequest(Map<String, Object> requestData, String devKey)
Builds the encrypted manual one-time purchase validation request (feature F-069), used when the app validates a purchase through the manual API rather than the auto-logging path.
-
sendManualSubscriptionPurchaseValidationRequest
final Call<String> sendManualSubscriptionPurchaseValidationRequest(Map<String, Object> requestData, String devKey)
Builds the encrypted manual subscription validation request (feature F-069), the manual-API counterpart of the auto-renewable subscription flow.
-
fetchRemoteConfiguration
final Call<RemoteConfiguration> fetchRemoteConfiguration(Boolean isSandbox, Boolean isStaging, String cdnToken, Integer timeoutMillis)
Builds the (unencrypted) remote-configuration fetch from the CDN. The URL is selected by UrlProvider based on isSandbox/isStaging and the cdnToken. timeoutMillis adds a per-request timeout backing up the queue's own interruption-based timeout (some
HttpURLConnectionimplementations do not react to thread interruption).
-
sendAppsFlyerEvent
final Call<String> sendAppsFlyerEvent(AFEvent event, String devKey, ContextProvider contextProvider)
Builds the request for a generic AFEvent (session, in-app, ad-revenue, etc.) — the main event-sending endpoint. The payload is prepared by
AFFinalizer(encrypted per AFEvent.isEncrypt) and security/checksum headers are attached when eligible (feature F-028, via addSecurityHeadersIfNeeded). The response body is returned raw, without model parsing.
-
sendDdlEvent
final Call<DdlResponse> sendDdlEvent(DdlEvent event)
Builds the Deferred Deep Link (DDL) request. The JSON body is derived from the event params and the response is parsed into a DdlResponse by DdlResponseConverter.
-
sendGcdRequest
final Call<Map<String, Object>> sendGcdRequest(String channelPostfix, String devKey)
Builds the Get-Conversion-Data (GCD) request (feature F-073). The request is HMAC-signed inside GcdRequest.create (feature F-016) and the response is parsed into a map by GcdResponseConverter.
-
sendCachedEvent
final Call<String> sendCachedEvent(CachedEvent event)
Builds the request for a CachedEvent — an event previously persisted to disk and resent on a later launch. The stored payload is used as-is; cached events are always encrypted.
-
createOneLink
final Call<String> createOneLink(String oneLinkId, Map<String, String> data, String brandDomain, UUID uuid, String devKey)
Builds a create-OneLink request (feature F-109) for the oneLinkId template. The JSON body carries the link data, uuid, TTL, and OneLink metadata; an optional brandDomain targets a custom domain. The request is signed over
POST+ body via generateOneLinkSignature (feature F-016) and sent unencrypted; the uuid is also part of the signature secret. HTTP cache is explicitly disabled for this call.
-
resolveOneLink
final Call<Map<String, String>> resolveOneLink(String oneLinkId, String shortLinkId, UUID uuid, String devKey)
Builds a resolve-OneLink request used by Unified Deep Linking (feature F-093) to expand the shortLinkId under the oneLinkId template into its link parameters. Device metadata is passed as
Af-Meta-*headers and the request is signed overGET+ uuid + IDs via generateOneLinkSignature (feature F-016); the uuid is also part of the signature secret.
-
crossPromoteImpression
final Call<String> crossPromoteImpression(String url)
Builds a cross-promotion impression request for the given url. Redirects are not followed — the redirect target URL is captured and handed to the launching activity — and a short dedicated timeout (CROSS_PROMOTE_TIMEOUT_MILLIS) is applied.
-
createRdRequest
final UploadRemoteDebugRequest createRdRequest(Map<String, Object> proxyData, String devKey)
Unlike the other APIs in this class, this method does not use ApiCallFactory nor return a Call: the HTTP request is not executed via the queue but by an UploadRemoteDebugRequest running on a background executor.
- Parameters:
proxyData- the request body.devKey- the client's dev key.
-
-
-
-