-
public class AppsFlyerLibCore extends AppsFlyerLib
-
-
Field Summary
Fields Modifier and Type Field Description public final static String
IS_STOP_TRACKING_USED
public final static String
BUILD_NUMBER
public final static String
LOG_TAG
public final static String
SERVER_BUILD_NUMBER
public final static String
SERVER_BUILD_NUMBER_AD_REVENUE
public final static String
INSTALL_UPDATE_DATE_FORMAT
public final static String
REFERRER_PREF
public final static String
EXTRA_REFERRERS_PREF
public final static String
PRE_INSTALL_PREF
public final static String
BUILD_URL_SUFFIX
public final static String
ENC_BUILD_URL_SUFFIX
public final static String
SENT_SUCCESSFULLY_PREF
public final static String
AF_COUNTER_PREF
public final static String
CACHED_CHANNEL_PREF
public volatile AppsFlyerConversionListener
conversionDataListener
public static AppsFlyerLibCore
instance
private SharedPreferences
sharedPreferences
-
Constructor Summary
Constructors Constructor Description AppsFlyerLibCore()
-
Method Summary
Modifier and Type Method Description static AppsFlyerLibCore
getInstance()
static synchronized SharedPreferences
getSharedPreferences(Context context)
static synchronized SharedPreferences
getSharedPreferences(Context context)
void
setContextToServiceLocator(@NonNull() Context context)
Provides context to the service locator in order to be able create context-sensitive dependencies. void
performOnAppAttribution(@NonNull() Context context, @NonNull() URI link)
Would not trigger re-engagement, session, launch. void
setSharingFilter(@NonNull() Array<String> partners)
Block events from being shared with ad networks and other 3rd party integrations void
setSharingFilterForAllPartners()
Block events from being shared with any partnerThis setter overwrite setSharingFilter. void
setSharingFilterForPartners(Array<String> partners)
Block events from being shared with ad networks and other 3rd party integrations.String "all" will block events from being shared with any partner. void
sendPurchaseData(Context context, Map<String, Object> requestData, PurchaseHandler.PurchaseValidationCallback callback)
Send ars purchase data for validation and reporting. void
sendInAppPurchaseData(Context context, Map<String, Object> requestData, PurchaseHandler.PurchaseValidationCallback callback)
Send in app purchase data for validation and reporting. void
appendParametersToDeepLinkingURL(String contains, Map<String, String> parameters)
void
subscribeForDeepLink(@NonNull() DeepLinkListener deepLinkListener)
void
subscribeForDeepLink(@NonNull() DeepLinkListener deepLinkListener, long timeout)
void
performOnDeepLinking(@NonNull() Intent intent, @NonNull() Context context)
Manual way of enabling Unified Deep Linking API without calling startIf DeepLinkListener is registered - supports both deferred (first launch only)and direct deep linkingIf AppsFlyerConversionListener is registered only supports direct deep linkingRecommended to call this from onResume of every activity that can belaunched via deep linkNotes:- Duplicate calls with the same intent containing the deep link will be deduplicated- Proper deep linking intent must have ACTION_VIEW and Uri data- Direct deep links processed by this API will not be reported to the server as of SDKv6.3.2. void
addPushNotificationDeepLinkPath(Array<String> deepLinkPath)
Resolve deep links from the push notification. void
setPartnerData(@NonNull() String partnerId, Map<String, Object> data)
Allows sending custom data for partner integration purposes. void
setDisableAdvertisingIdentifiers(boolean disable)
Disable collection of Google, Amazon and Open advertising ids (GAID, AAID, OAID).By default collection is enabled. void
setDisableNetworkData(boolean disable)
Use this API to prevent the SDK from collecting the network operator name (carrier) and simoperator name from the deviceBy default collection is enabled. void
stop(boolean shouldStop, Context context)
Once this API is invoked, our SDK no longer communicates with our servers and stops functioning.In some extreme cases you might want to shut down all SDK logging due to legal and privacy compliance. String
getSdkVersion()
Get the AppsFlyer SDK version used in app. void
onPause(Context context)
For Cocos2dx platform onlyCocos2dx has his own applicationDidEnterBackground event. void
updateServerUninstallToken(Context context, String token)
Manually pass the Firebase Device Token for Uninstall Measurement. void
setDebugLog(boolean shouldEnable)
Enables Debug logs for the AppsFlyer SDK.Should only be set to true in development / debug. void
setImeiData(String imei)
By default, IMEI and Android ID are not collected by the SDK if the OS version is higher than KitKat (4.4)and the device contains Google Play Services (on SDK versions 4.8.8 and below the specific app needed GPS).Use this API to explicitly send IMEI to AppsFlyer. void
setOaidData(String oaid)
By default, OAID is not collected by the SDK.Use this API to explicitly send OAID to AppsFlyer. void
setAndroidIdData(String androidId)
By default, IMEI and Android ID are not collected by the SDK if the OS version is higher than KitKat (4.4)and the device contains Google Play Services (on SDK versions 4.8.8 and below the specific app needed GPS).Use this API to explicitly send Android ID to AppsFlyer. void
setProperty(String key, String value)
String
getProperty(String key)
boolean
waitingForId()
void
waitForCustomerUserId(boolean wait)
It is possible to delay the SDK Initialization until the customerUserID is set.This feature makes sure that the SDK doesn't begin functioning until the customerUserID is provided.If this API is used, all in-app events and any other SDK API calls are discarded, until the customerUserID is provided and logged. void
setCustomerIdAndLogSession(String id, @NonNull() Context context)
Use this API to provide the SDK with the relevant customer user id and trigger the SDK to begin its normal logging. String
getOutOfStore(Context context)
Get the current AF_STORE value. void
setOutOfStore(String sourceName)
Manually set the AF_STORE value. void
setAppInviteOneLink(String oneLinkId)
Set the OneLink ID that should be used for User-Invite-loggingThe link that is generated for the user invite will use this OneLink as the base link. void
setAdditionalData(Map<String, Object> customData)
Set additional data to be sent to AppsFlyer. void
sendPushNotificationData(@Nullable() Activity activity)
Allows you to measure push notifications as part of a retargeting campaign. void
setUserEmails(Array<String> emails)
Set the user emails void
setUserEmails(AppsFlyerProperties.EmailsCryptType cryptMethod, Array<String> emails)
Set the user emails and encrypt them. void
setCollectAndroidID(boolean isCollect)
Opt-out of collection of Android ID.If the app does NOT contain Google Play Services, Android ID is collected by the SDK.However, apps with Google play services should avoid Android ID collection as this is in violation of the Google Play policy. void
setCollectIMEI(boolean isCollect)
Opt-out of collection of IMEI.If the app does NOT contain Google Play Services, device IMEI is collected by the SDK.However, apps with Google play services should avoid IMEI collection as this is in violation of the Google Play policy. void
setCollectOaid(boolean isCollect)
void
setResolveDeepLinkURLs(Array<String> urls)
Advertisers can wrap AppsFlyer OneLink within another Universal Link.This Universal Link will invoke the app but any deep linking data will not propagate to AppsFlyer. void
setOneLinkCustomDomain(Array<String> domains)
In order for AppsFlyer SDK to successfully resolve hidden (decoded in shortlink ID)attribution params any domain that is configured as branded domain in AppsFlyer Dashboard should be provided in this API AppsFlyerLib
init(@NonNull() String key, AppsFlyerConversionListener conversionDataListener, @NonNull() Context context)
Use this method to initialize AppsFlyer SDK.This API should be called inside your Application class's onCreate method. void
enableFacebookDeferredApplinks(boolean isEnabled)
Enable the collection of Facebook Deferred AppLinksRequires Facebook SDK and Facebook app on target/client device.This API must be invoked prior to initializing the AppsFlyer SDK in order to function properly. void
start(@NonNull() Context context)
void
start(@NonNull() Context context, String key)
void
start(@NonNull() Context context, String key, AppsFlyerRequestListener appsFlyerRequestListener)
String
getCustomerUserId()
void
setCustomerUserId(String id)
Setting your own customer ID enables you to cross-reference your own unique ID with AppsFlyer’s unique ID and the other devices’ IDs.This ID is available in AppsFlyer CSV reports along with Postback APIs for cross-referencing with your internal IDs. void
setPhoneNumber(String phoneNumber)
Will be sent as SHA-256 void
setAppId(String id)
void
setExtension(String extension)
SDK plugins and extensions will set this field void
setIsUpdate(boolean isUpdate)
Manually set that the application was updated. void
setCurrencyCode(String currencyCode)
Setting user local currency code for in-app purchases.The currency code should be a 3 character ISO 4217 code. void
logLocation(Context context, double latitude, double longitude)
Manually log the location of the user void
logSession(Context ctx)
If your app is a utility app running in the background you can use this API in your activity’s onCreate() void
logEvent(@NonNull() Context context, String eventName, Map<String, Object> eventValues, AppsFlyerRequestListener appsFlyerRequestListener)
Same as logEvent with AppsFlyerRequestListener. void
sendAdRevenue(Context context, Map<String, Object> adRevenuePayload)
void
sendAdImpression(Context context, Map<String, Object> adImpressionPayload)
void
logEvent(Context context, String eventName, Map<String, Object> eventValues)
Log an In-App Event.In-App Events provide insight on what is happening in your app. void
anonymizeUser(boolean shouldAnonymize)
Anonymize user Data.Use this API during the SDK Initialization to explicitly anonymize a user's installs, events and sessions. void
registerConversionListener(Context context, AppsFlyerConversionListener conversionDataListener)
Register a Conversion Data Listener.Allows the developer to access the user attribution data in real-time for every new install, directly from the SDK level.By doing this you can serve users with personalized content or send them to specific activities within the app,which can greatly enhance their engagement with your app. void
unregisterConversionListener()
Unregister a previously registered AppsFlyerConversionListener. void
registerValidatorListener(Context context, AppsFlyerInAppPurchaseValidatorListener validationListener)
Register a validation listener for the validateAndLogInAppPurchase API. String
dateFormatUTC(SimpleDateFormat dateFormat, long time)
static Map<String, Object>
getMetaFrom(Map<String, Object> params)
void
handleDeepLinkCallback(Context context, DeeplinkDataCollector deeplinkDataCollector, Uri resolvedUri, @Nullable() Uri espOriginalUri)
boolean
isGooglePlayServicesAvailable(Context context)
String
getManifestMetaData(Context context, String key)
void
setPreinstallAttribution(String mediaSource, String campaign, String siteId)
Specify the manufacturer or media source name to which the preinstall is attributed. boolean
isPreInstalledApp(Context context)
Boolean indicator for preinstall by Manufacturer. static String
getCachedChannel(AppsFlyerPreferences prefs, String currentChannel)
String
getAttributionId(Context context)
Get the Facebook attribution ID, if one exists. AppsFlyerPreferences
getAppsFlyerPreferences(Context context)
final int
getLaunchCounter(AppsFlyerPreferences sharedPreferences, boolean isIncrease)
String
getAppsFlyerUID(@NonNull() Context context)
Get AppsFlyer's unique device ID is created for every new install of an app. void
validateAndLogInAppPurchase(Context context, String publicKey, String signature, String purchaseData, String price, String currency, Map<String, String> additionalParameters)
API for server verification of in-app purchases.An af_purchase event with the relevant values will be automatically logged if the validation is successful. boolean
isStopped()
static String
readServerResponse(HttpURLConnection connection)
Kept to maintain compatibility of non-queue build variant. void
setLogLevel(@NonNull() AFLogger.LogLevel logLevel)
Sets the SDK's Log Level. void
setHost(@Nullable() String hostPrefixName, @NonNull() String hostName)
Set a custom host. String
getHostName()
Get the host name.Default value is "appsflyer. String
getHostPrefix()
Get the custom set host prefix. void
setMinTimeBetweenSessions(int seconds)
Set a custom value for the minimum required time between sessions.By default, at least 5 seconds must lapse between 2 app launches to count as separate 2 sessions. Array<Referrer>
getReferrers()
static void
setUrl(Map<String, String> mapOfURLs)
void
setPluginInfo(@NonNull() PluginInfo pluginInfo)
Internal API. -
Methods inherited from class com.appsflyer.AppsFlyerLib
appendParametersToDeepLinkingURL, getInstance, init, logEvent, logEvent, performOnDeepLinking, registerConversionListener, registerValidatorListener, sendAdImpression, sendAdRevenue, sendPushNotificationData, setLogLevel, setUserEmails, start, subscribeForDeepLink, subscribeForDeepLink, validateAndLogInAppPurchase
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getInstance
static AppsFlyerLibCore getInstance()
-
getSharedPreferences
static synchronized SharedPreferences getSharedPreferences(Context context)
-
getSharedPreferences
static synchronized SharedPreferences getSharedPreferences(Context context)
-
setContextToServiceLocator
void setContextToServiceLocator(@NonNull() Context context)
Provides context to the service locator in order to be able create context-sensitive dependencies.
- Parameters:
context
- getApplicationContext will be used under the hood
-
performOnAppAttribution
@Deprecated() void performOnAppAttribution(@NonNull() Context context, @NonNull() URI link)
Would not trigger re-engagement, session, launch. Only deep link resolving.
-
setSharingFilter
@Deprecated() void setSharingFilter(@NonNull() Array<String> partners)
Block events from being shared with ad networks and other 3rd party integrations
- Parameters:
partners
- must only include letters/digits and underscore, maximum length: 45
-
setSharingFilterForAllPartners
@Deprecated() void setSharingFilterForAllPartners()
Block events from being shared with any partnerThis setter overwrite setSharingFilter.
-
setSharingFilterForPartners
void setSharingFilterForPartners(Array<String> partners)
Block events from being shared with ad networks and other 3rd party integrations.String "all" will block events from being shared with any partner.
- Parameters:
partners
- must only include letters/digits and underscore, maximum length: 45
-
sendPurchaseData
void sendPurchaseData(Context context, Map<String, Object> requestData, PurchaseHandler.PurchaseValidationCallback callback)
Send ars purchase data for validation and reporting. Not intended for public usage, to be usedonly from AppsFlyer Purchase Connector module
- Parameters:
context
- Application contextrequestData
- ars purchase data for validationcallback
- to return the validation result
-
sendInAppPurchaseData
void sendInAppPurchaseData(Context context, Map<String, Object> requestData, PurchaseHandler.PurchaseValidationCallback callback)
Send in app purchase data for validation and reporting. Not intended for public usage, to be usedonly from AppsFlyer Purchase Connector module
- Parameters:
context
- Application contextrequestData
- in app purchase data for validationcallback
- to return the validation result
-
appendParametersToDeepLinkingURL
void appendParametersToDeepLinkingURL(String contains, Map<String, String> parameters)
-
subscribeForDeepLink
void subscribeForDeepLink(@NonNull() DeepLinkListener deepLinkListener)
-
subscribeForDeepLink
void subscribeForDeepLink(@NonNull() DeepLinkListener deepLinkListener, long timeout)
-
performOnDeepLinking
void performOnDeepLinking(@NonNull() Intent intent, @NonNull() Context context)
Manual way of enabling Unified Deep Linking API without calling startIf DeepLinkListener is registered - supports both deferred (first launch only)and direct deep linkingIf AppsFlyerConversionListener is registered only supports direct deep linkingRecommended to call this from onResume of every activity that can belaunched via deep linkNotes:- Duplicate calls with the same intent containing the deep link will be deduplicated- Proper deep linking intent must have ACTION_VIEW and Uri data- Direct deep links processed by this API will not be reported to the server as of SDKv6.3.2. This may affect install attribution or re-engagement records.
-
addPushNotificationDeepLinkPath
void addPushNotificationDeepLinkPath(Array<String> deepLinkPath)
Resolve deep links from the push notification.
Specify path to deeplink url in the data part of the push notification payloadin order to get them resolved to 1 of the the callbacks when app is opened by a clickon a notification:
onDeepLinkingonAppOpenAttribution- Parameters:
deepLinkPath
- List of path elements in correct order
-
setPartnerData
void setPartnerData(@NonNull() String partnerId, Map<String, Object> data)
Allows sending custom data for partner integration purposes.
- Parameters:
partnerId
- ID of the partner (usually has "_int" suffix)data
- customer data, depends on the integration nature with specific partner
-
setDisableAdvertisingIdentifiers
void setDisableAdvertisingIdentifiers(boolean disable)
Disable collection of Google, Amazon and Open advertising ids (GAID, AAID, OAID).By default collection is enabled.
-
setDisableNetworkData
void setDisableNetworkData(boolean disable)
Use this API to prevent the SDK from collecting the network operator name (carrier) and simoperator name from the deviceBy default collection is enabled.
-
stop
void stop(boolean shouldStop, Context context)
Once this API is invoked, our SDK no longer communicates with our servers and stops functioning.In some extreme cases you might want to shut down all SDK logging due to legal and privacy compliance.This can be achieved with the isStopped API
- Parameters:
shouldStop
- should logging be stopped.context
- Application / Activity context.
-
getSdkVersion
String getSdkVersion()
Get the AppsFlyer SDK version used in app.
-
onPause
void onPause(Context context)
For Cocos2dx platform onlyCocos2dx has his own applicationDidEnterBackground event.Therefore 'onPause' will be called from C++ by JNI
-
updateServerUninstallToken
void updateServerUninstallToken(Context context, String token)
Manually pass the Firebase Device Token for Uninstall Measurement.
- Parameters:
context
- Application / Activity context.token
- Firebase Device Token.
-
setDebugLog
void setDebugLog(boolean shouldEnable)
Enables Debug logs for the AppsFlyer SDK.Should only be set to true in development / debug.
- Parameters:
shouldEnable
- boolean.
-
setImeiData
void setImeiData(String imei)
By default, IMEI and Android ID are not collected by the SDK if the OS version is higher than KitKat (4.4)and the device contains Google Play Services (on SDK versions 4.8.8 and below the specific app needed GPS).Use this API to explicitly send IMEI to AppsFlyer.
- Parameters:
imei
- device's IMEI.
-
setOaidData
void setOaidData(String oaid)
By default, OAID is not collected by the SDK.Use this API to explicitly send OAID to AppsFlyer.
- Parameters:
oaid
- device's OAID.
-
setAndroidIdData
void setAndroidIdData(String androidId)
By default, IMEI and Android ID are not collected by the SDK if the OS version is higher than KitKat (4.4)and the device contains Google Play Services (on SDK versions 4.8.8 and below the specific app needed GPS).Use this API to explicitly send Android ID to AppsFlyer.
- Parameters:
androidId
- device's Android ID.
-
setProperty
void setProperty(String key, String value)
-
getProperty
String getProperty(String key)
-
waitingForId
boolean waitingForId()
-
waitForCustomerUserId
void waitForCustomerUserId(boolean wait)
It is possible to delay the SDK Initialization until the customerUserID is set.This feature makes sure that the SDK doesn't begin functioning until the customerUserID is provided.If this API is used, all in-app events and any other SDK API calls are discarded, until the customerUserID is provided and logged.
- Parameters:
wait
- boolean.
-
setCustomerIdAndLogSession
void setCustomerIdAndLogSession(String id, @NonNull() Context context)
Use this API to provide the SDK with the relevant customer user id and trigger the SDK to begin its normal logging.
- Parameters:
id
- Customer ID for client.context
- Application / Activity context.
-
getOutOfStore
String getOutOfStore(Context context)
Get the current AF_STORE value.
- Parameters:
context
- Application / Activity context.
-
setOutOfStore
void setOutOfStore(String sourceName)
Manually set the AF_STORE value.
- Parameters:
sourceName
- value to be set.
-
setAppInviteOneLink
void setAppInviteOneLink(String oneLinkId)
Set the OneLink ID that should be used for User-Invite-loggingThe link that is generated for the user invite will use this OneLink as the base link.
- Parameters:
oneLinkId
- OneLink ID obtained from the AppsFlyer Dashboard.
-
setAdditionalData
void setAdditionalData(Map<String, Object> customData)
Set additional data to be sent to AppsFlyer.
- Parameters:
customData
- additional data HashMap.
-
sendPushNotificationData
void sendPushNotificationData(@Nullable() Activity activity)
Allows you to measure push notifications as part of a retargeting campaign.To enable this feature, call the next method inside the onResume method of every Activity which will be launched upon clicking the notification.
- Parameters:
activity
- The Activity which will be launched upon clicking the notification.
-
setUserEmails
void setUserEmails(Array<String> emails)
Set the user emails
- Parameters:
emails
- User emails.
-
setUserEmails
void setUserEmails(AppsFlyerProperties.EmailsCryptType cryptMethod, Array<String> emails)
Set the user emails and encrypt them.
- Parameters:
cryptMethod
- Encryption method:AppsFlyerProperties.EmailsCryptType.NONE,AppsFlyerProperties.EmailsCryptType.SHA1,AppsFlyerProperties.EmailsCryptType.MD5,AppsFlyerProperties.EmailsCryptType.emails
- User emails.
-
setCollectAndroidID
void setCollectAndroidID(boolean isCollect)
Opt-out of collection of Android ID.If the app does NOT contain Google Play Services, Android ID is collected by the SDK.However, apps with Google play services should avoid Android ID collection as this is in violation of the Google Play policy.
- Parameters:
isCollect
- boolean, false to opt-out.
-
setCollectIMEI
void setCollectIMEI(boolean isCollect)
Opt-out of collection of IMEI.If the app does NOT contain Google Play Services, device IMEI is collected by the SDK.However, apps with Google play services should avoid IMEI collection as this is in violation of the Google Play policy.
- Parameters:
isCollect
- boolean, false to opt-out.
-
setCollectOaid
@Deprecated() void setCollectOaid(boolean isCollect)
-
setResolveDeepLinkURLs
void setResolveDeepLinkURLs(Array<String> urls)
Advertisers can wrap AppsFlyer OneLink within another Universal Link.This Universal Link will invoke the app but any deep linking data will not propagate to AppsFlyer.
setResolveDeepLinkURLs
API allows to Appsflyer SDK to resolveprovided urls, to be able to deep link from a OneLinkwrapped within another Universal Link and also log this retargetingconversion.For example:
"example.com"
"example.com/param1"
"example.com/param1/param2"
Note, if
"example.com"
is provided, the App link"my.example.com"
will not match because of prefix"my."
Be sure to provide explicit url names- Parameters:
urls
- - Array of urls
-
setOneLinkCustomDomain
void setOneLinkCustomDomain(Array<String> domains)
In order for AppsFlyer SDK to successfully resolve hidden (decoded in shortlink ID)attribution params any domain that is configured as branded domain in AppsFlyer Dashboard should be provided in this API
- Parameters:
domains
- Array of domains that should be treated by SDK as branded (SDK will try toresolve them as Onelinks)
-
init
AppsFlyerLib init(@NonNull() String key, AppsFlyerConversionListener conversionDataListener, @NonNull() Context context)
Use this method to initialize AppsFlyer SDK.This API should be called inside your Application class's onCreate method.
- Parameters:
key
- AppsFlyer's Dev-Key, which is accessible from your AppsFlyeraccount, under 'App Settings' in the dashboard.conversionDataListener
- (Optional) implement the ConversionDataListener toaccess AppsFlyer's conversion data.context
- to handle new install referrer
-
enableFacebookDeferredApplinks
void enableFacebookDeferredApplinks(boolean isEnabled)
Enable the collection of Facebook Deferred AppLinksRequires Facebook SDK and Facebook app on target/client device.This API must be invoked prior to initializing the AppsFlyer SDK in order to function properly.
- Parameters:
isEnabled
- should Facebook's deferred app links be processed by the AppsFlyer SDK.
-
start
void start(@NonNull() Context context, String key, AppsFlyerRequestListener appsFlyerRequestListener)
- Parameters:
context
- Application if calling in onCreate orActivity if calling after onResumekey
- AppsFlyer's Dev-Key, which is accessible from your AppsFlyer account, under'App Settings' in the dashboard
-
getCustomerUserId
String getCustomerUserId()
-
setCustomerUserId
void setCustomerUserId(String id)
Setting your own customer ID enables you to cross-reference your own unique ID with AppsFlyer’s unique ID and the other devices’ IDs.This ID is available in AppsFlyer CSV reports along with Postback APIs for cross-referencing with your internal IDs.
- Parameters:
id
- Customer ID for client.
-
setPhoneNumber
void setPhoneNumber(String phoneNumber)
Will be sent as SHA-256
-
setExtension
void setExtension(String extension)
SDK plugins and extensions will set this field
-
setIsUpdate
void setIsUpdate(boolean isUpdate)
Manually set that the application was updated.
- Parameters:
isUpdate
- boolean value
-
setCurrencyCode
void setCurrencyCode(String currencyCode)
Setting user local currency code for in-app purchases.The currency code should be a 3 character ISO 4217 code. (default is USD).You can set the currency code for all events by calling the following method
- Parameters:
currencyCode
- 3 character ISO 4217 code
-
logLocation
void logLocation(Context context, double latitude, double longitude)
Manually log the location of the user
- Parameters:
context
- Application / Activity contextlatitude
- latitude as doublelongitude
- longitude as double
-
logSession
void logSession(Context ctx)
If your app is a utility app running in the background you can use this API in your activity’s onCreate()
- Parameters:
ctx
- Application / Activity context
-
logEvent
void logEvent(@NonNull() Context context, String eventName, Map<String, Object> eventValues, AppsFlyerRequestListener appsFlyerRequestListener)
Same as logEvent with AppsFlyerRequestListener. HTTP_OK fromserver will invoke the onSuccess method. onError will returnthe error in case one occurs
-
sendAdRevenue
void sendAdRevenue(Context context, Map<String, Object> adRevenuePayload)
-
sendAdImpression
void sendAdImpression(Context context, Map<String, Object> adImpressionPayload)
-
logEvent
void logEvent(Context context, String eventName, Map<String, Object> eventValues)
Log an In-App Event.In-App Events provide insight on what is happening in your app.
- Parameters:
context
- Application / Activity contexteventName
- Event Name as StringeventValues
- Event Values as Map
-
anonymizeUser
void anonymizeUser(boolean shouldAnonymize)
Anonymize user Data.Use this API during the SDK Initialization to explicitly anonymize a user's installs, events and sessions.Default is false
- Parameters:
shouldAnonymize
- boolean
-
registerConversionListener
void registerConversionListener(Context context, AppsFlyerConversionListener conversionDataListener)
Register a Conversion Data Listener.Allows the developer to access the user attribution data in real-time for every new install, directly from the SDK level.By doing this you can serve users with personalized content or send them to specific activities within the app,which can greatly enhance their engagement with your app.
- Parameters:
context
- Application / Activity contextconversionDataListener
- AppsFlyerConversionListener interface withonConversionDataSuccess
andonAppOpenAttribution
callback methods.
-
unregisterConversionListener
void unregisterConversionListener()
Unregister a previously registered AppsFlyerConversionListener.
-
registerValidatorListener
void registerValidatorListener(Context context, AppsFlyerInAppPurchaseValidatorListener validationListener)
Register a validation listener for the validateAndLogInAppPurchase API.
- Parameters:
context
- Application / Activity context.validationListener
- AppsFlyerInAppPurchaseValidatorListener interface with \onValidateInApp
andonValidateInAppFailure
callback methods
-
dateFormatUTC
String dateFormatUTC(SimpleDateFormat dateFormat, long time)
-
handleDeepLinkCallback
void handleDeepLinkCallback(Context context, DeeplinkDataCollector deeplinkDataCollector, Uri resolvedUri, @Nullable() Uri espOriginalUri)
- Parameters:
resolvedUri
- The resolved URL after all redirects have been followed (if any).espOriginalUri
- If app has been started via ESP app link click (or ESP link has been providedvia #performOnAppAttribution this parameter will hold original link, before all redirects.Will be null if original link is not ESP link.
-
isGooglePlayServicesAvailable
boolean isGooglePlayServicesAvailable(Context context)
-
getManifestMetaData
@Nullable() String getManifestMetaData(Context context, String key)
-
setPreinstallAttribution
void setPreinstallAttribution(String mediaSource, String campaign, String siteId)
Specify the manufacturer or media source name to which the preinstall is attributed.
- Parameters:
mediaSource
- Manufacturer or media source name for preinstall attribution.campaign
- Campaign name for preinstall attribution.siteId
- Site ID for preinstall attribution.
-
isPreInstalledApp
boolean isPreInstalledApp(Context context)
Boolean indicator for preinstall by Manufacturer.
- Parameters:
context
- Application / Activity context.
-
getCachedChannel
static String getCachedChannel(AppsFlyerPreferences prefs, String currentChannel)
-
getAttributionId
String getAttributionId(Context context)
Get the Facebook attribution ID, if one exists.
-
getAppsFlyerPreferences
AppsFlyerPreferences getAppsFlyerPreferences(Context context)
-
getLaunchCounter
final int getLaunchCounter(AppsFlyerPreferences sharedPreferences, boolean isIncrease)
-
getAppsFlyerUID
@Nullable() String getAppsFlyerUID(@NonNull() Context context)
Get AppsFlyer's unique device ID is created for every new install of an app.
- Parameters:
context
- Application / Activity context.
-
validateAndLogInAppPurchase
void validateAndLogInAppPurchase(Context context, String publicKey, String signature, String purchaseData, String price, String currency, Map<String, String> additionalParameters)
API for server verification of in-app purchases.An af_purchase event with the relevant values will be automatically logged if the validation is successful.
- Parameters:
context
- Application / Activity context.publicKey
- License Key obtained from the Google Play Console.signature
-data.INAPP_DATA_SIGNATURE
fromonActivityResult(int requestCode, int resultCode, Intent data)
purchaseData
-data.INAPP_PURCHASE_DATA
fromonActivityResult(int requestCode, int resultCode, Intent data)
price
- Purchase price, should be derived fromskuDetails.getStringArrayList("DETAILS_LIST")
currency
- Purchase currency, should be derived fromskuDetails.getStringArrayList("DETAILS_LIST")
additionalParameters
- Freehand parameters to be logged with the purchase (if validated).
-
isStopped
@Deprecated() boolean isStopped()
-
readServerResponse
@Deprecated()@NonNull() static String readServerResponse(HttpURLConnection connection)
Kept to maintain compatibility of non-queue build variant. To be removed when queue operational
-
setLogLevel
void setLogLevel(@NonNull() AFLogger.LogLevel logLevel)
Sets the SDK's Log Level.
- Parameters:
logLevel
- logLevel as String:AFLogger.LogLevel.NONE,AFLogger.LogLevel.ERROR,AFLogger.LogLevel.WARNING,AFLogger.LogLevel.INFO,AFLogger.LogLevel.DEBUG,AFLogger.LogLevel.VERBOSE.
-
setHost
void setHost(@Nullable() String hostPrefixName, @NonNull() String hostName)
Set a custom host.
- Parameters:
hostPrefixName
- Host prefix.hostName
- Host name.
-
getHostName
String getHostName()
Get the host name.Default value is "appsflyer.com"
-
getHostPrefix
String getHostPrefix()
Get the custom set host prefix.
-
setMinTimeBetweenSessions
void setMinTimeBetweenSessions(int seconds)
Set a custom value for the minimum required time between sessions.By default, at least 5 seconds must lapse between 2 app launches to count as separate 2 sessions.
- Parameters:
seconds
- minimum time between 2 separate sessions in seconds.
-
getReferrers
@NonNull() Array<Referrer> getReferrers()
-
setPluginInfo
void setPluginInfo(@NonNull() PluginInfo pluginInfo)
Internal API. Please don't use.Throws: NullPointerException – if pluginInfo is null.
-
-
-
-