Package io.adtrace.sdk
Class AdTrace
java.lang.Object
io.adtrace.sdk.AdTrace
AdTrace android SDK (https://adtrace.io)
Created by Nasser Amini (github.com/namini40) on April 2022.
Notice: See LICENSE.txt for modification and distribution information
Copyright © 2022.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddSessionCallbackParameter(String key, String value) Called to add global callback parameter that will be sent with each session and event.static voidaddSessionPartnerParameter(String key, String value) Called to add global partner parameter that will be sent with each session and event.static voidappWillOpenUrl(android.net.Uri url) Deprecated.static voidappWillOpenUrl(android.net.Uri url, android.content.Context context) Called to process deep link.static voiddisableThirdPartySharing(android.content.Context context) Called to disable the third party sharing.static voidgdprForgetMe(android.content.Context context) Called to forget the user in accordance with GDPR law.static StringgetAdid()Called to get value of unique AdTrace device identifier.static StringgetAmazonAdId(android.content.Context context) Called to get value of Amazon Advertising Identifier.static AdTraceAttributionCalled to get user's current attribution value.static AdTraceInstanceMethod used to obtain AdTrace SDK singleton instance.static voidgetGoogleAdId(android.content.Context context, OnDeviceIdsRead onDeviceIdRead) Called to get value of Google Play Advertising Identifier.static StringCalled to get native SDK version string.static booleanisAdTraceUninstallDetectionPayload(Map<String, String> payload) Get information if the payload originates from AdTrace.static booleanGet information if SDK is enabled or not.static voidonCreate(AdTraceConfig adTraceConfig) Called upon SDK initialisation.static voidonPause()Called upon each Activity's onPause() method call.static voidonResume()Called upon each Activity's onResume() method call.static voidCalled to remove global callback parameter from session and event packages.static voidCalled to remove global partner parameter from session and event packages.static voidCalled to remove all added global callback parameters.static voidCalled to remove all added global partner parameters.static voidCalled if SDK initialisation was delayed and you would like to stop waiting for timer.static voidsetEnabled(boolean enabled) Called to disable/enable SDK.static voidsetOfflineMode(boolean enabled) Called to set SDK to offline or online mode.static voidsetPushToken(String token) Deprecated.usesetPushToken(String, Context)instead.static voidsetPushToken(String token, android.content.Context context) Called to set user's push notifications token.static voidsetReferrer(String referrer, android.content.Context context) Called to process referrer information sent with INSTALL_REFERRER intent.static voidsetTestOptions(AdTraceTestOptions testOptions) Used for testing purposes only.static voidtrackAdRevenue(AdTraceAdRevenue adtraceAdRevenue) Track ad revenue from a source providerstatic voidtrackAdRevenue(String source, org.json.JSONObject payload) Track ad revenue from a source providerstatic voidtrackEvent(AdTraceEvent event) Called to track event.static voidtrackMeasurementConsent(boolean consentMeasurement) static voidtrackPlayStoreSubscription(AdTracePlayStoreSubscription subscription) Track subscription from Google Play.static voidtrackThirdPartySharing(AdTraceThirdPartySharing adTraceThirdPartySharing)
-
Method Details
-
getDefaultInstance
Method used to obtain AdTrace SDK singleton instance.- Returns:
- AdTrace SDK singleton instance.
-
onCreate
Called upon SDK initialisation.- Parameters:
adTraceConfig- AdTraceConfig object used for SDK initialisation
-
trackEvent
Called to track event.- Parameters:
event- AdTraceEvent object to be tracked
-
onResume
public static void onResume()Called upon each Activity's onResume() method call. -
onPause
public static void onPause()Called upon each Activity's onPause() method call. -
setEnabled
public static void setEnabled(boolean enabled) Called to disable/enable SDK.- Parameters:
enabled- boolean indicating whether SDK should be enabled or disabled
-
isEnabled
public static boolean isEnabled()Get information if SDK is enabled or not.- Returns:
- boolean indicating whether SDK is enabled or not
-
isAdTraceUninstallDetectionPayload
Get information if the payload originates from AdTrace.- Returns:
- boolean indicating whether payload originates from AdTrace or not.
-
appWillOpenUrl
Deprecated.UseappWillOpenUrl(Uri, Context)} instead.Called to process deep link.- Parameters:
url- Deep link URL to process
-
appWillOpenUrl
public static void appWillOpenUrl(android.net.Uri url, android.content.Context context) Called to process deep link.- Parameters:
url- Deep link URL to processcontext- Application context
-
setReferrer
Called to process referrer information sent with INSTALL_REFERRER intent.- Parameters:
referrer- Referrer contentcontext- Application context
-
setOfflineMode
public static void setOfflineMode(boolean enabled) Called to set SDK to offline or online mode.- Parameters:
enabled- boolean indicating should SDK be in offline mode (true) or not (false)
-
sendFirstPackages
public static void sendFirstPackages()Called if SDK initialisation was delayed and you would like to stop waiting for timer. -
addSessionCallbackParameter
Called to add global callback parameter that will be sent with each session and event.- Parameters:
key- Global callback parameter keyvalue- Global callback parameter value
-
addSessionPartnerParameter
Called to add global partner parameter that will be sent with each session and event.- Parameters:
key- Global partner parameter keyvalue- Global partner parameter value
-
removeSessionCallbackParameter
Called to remove global callback parameter from session and event packages.- Parameters:
key- Global callback parameter key
-
removeSessionPartnerParameter
Called to remove global partner parameter from session and event packages.- Parameters:
key- Global partner parameter key
-
resetSessionCallbackParameters
public static void resetSessionCallbackParameters()Called to remove all added global callback parameters. -
resetSessionPartnerParameters
public static void resetSessionPartnerParameters()Called to remove all added global partner parameters. -
setPushToken
Deprecated.usesetPushToken(String, Context)instead.Called to set user's push notifications token.- Parameters:
token- Push notifications token
-
setPushToken
Called to set user's push notifications token.- Parameters:
token- Push notifications tokencontext- Application context
-
gdprForgetMe
public static void gdprForgetMe(android.content.Context context) Called to forget the user in accordance with GDPR law.- Parameters:
context- Application context
-
disableThirdPartySharing
public static void disableThirdPartySharing(android.content.Context context) Called to disable the third party sharing.- Parameters:
context- Application context
-
trackThirdPartySharing
-
trackMeasurementConsent
public static void trackMeasurementConsent(boolean consentMeasurement) -
trackAdRevenue
Track ad revenue from a source provider- Parameters:
source- Source of ad revenue information, see AdTraceConfig.AD_REVENUE_* for some possible sourcespayload- JsonObject content of the ad revenue information
-
trackAdRevenue
Track ad revenue from a source provider- Parameters:
adtraceAdRevenue- AdTrace ad revenue information like source, revenue, currency etc
-
trackPlayStoreSubscription
Track subscription from Google Play.- Parameters:
subscription- AdTracePlayStoreSubscription object to be tracked
-
getGoogleAdId
Called to get value of Google Play Advertising Identifier.- Parameters:
context- Application contextonDeviceIdRead- Callback to get triggered once identifier is obtained
-
getAmazonAdId
Called to get value of Amazon Advertising Identifier.- Parameters:
context- Application context- Returns:
- Amazon Advertising Identifier
-
getAdid
Called to get value of unique AdTrace device identifier.- Returns:
- Unique AdTrace device indetifier
-
getAttribution
Called to get user's current attribution value.- Returns:
- AdTraceAttribution object with current attribution value
-
getSdkVersion
Called to get native SDK version string.- Returns:
- Native SDK version string.
-
setTestOptions
Used for testing purposes only. Do NOT use this method.- Parameters:
testOptions- AdTrace integration tests options
-
appWillOpenUrl(Uri, Context)} instead.