diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /mobile/android/thirdparty/com/adjust/sdk/AdjustInstance.java | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'mobile/android/thirdparty/com/adjust/sdk/AdjustInstance.java')
-rw-r--r-- | mobile/android/thirdparty/com/adjust/sdk/AdjustInstance.java | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/mobile/android/thirdparty/com/adjust/sdk/AdjustInstance.java b/mobile/android/thirdparty/com/adjust/sdk/AdjustInstance.java new file mode 100644 index 000000000..158fb7ca1 --- /dev/null +++ b/mobile/android/thirdparty/com/adjust/sdk/AdjustInstance.java @@ -0,0 +1,86 @@ +package com.adjust.sdk; + +import android.net.Uri; + +/** + * Created by pfms on 04/12/14. + */ +public class AdjustInstance { + + private String referrer; + private long referrerClickTime; + private ActivityHandler activityHandler; + + private static ILogger getLogger() { + return AdjustFactory.getLogger(); + } + + public void onCreate(AdjustConfig adjustConfig) { + if (activityHandler != null) { + getLogger().error("Adjust already initialized"); + return; + } + + adjustConfig.referrer = this.referrer; + adjustConfig.referrerClickTime = this.referrerClickTime; + + activityHandler = ActivityHandler.getInstance(adjustConfig); + } + + public void trackEvent(AdjustEvent event) { + if (!checkActivityHandler()) return; + activityHandler.trackEvent(event); + } + + public void onResume() { + if (!checkActivityHandler()) return; + activityHandler.trackSubsessionStart(); + } + + public void onPause() { + if (!checkActivityHandler()) return; + activityHandler.trackSubsessionEnd(); + } + + public void setEnabled(boolean enabled) { + if (!checkActivityHandler()) return; + activityHandler.setEnabled(enabled); + } + + public boolean isEnabled() { + if (!checkActivityHandler()) return false; + return activityHandler.isEnabled(); + } + + public void appWillOpenUrl(Uri url) { + if (!checkActivityHandler()) return; + long clickTime = System.currentTimeMillis(); + activityHandler.readOpenUrl(url, clickTime); + } + + public void sendReferrer(String referrer) { + long clickTime = System.currentTimeMillis(); + // sendReferrer might be triggered before Adjust + if (activityHandler == null) { + // save it to inject in the config before launch + this.referrer = referrer; + this.referrerClickTime = clickTime; + } else { + activityHandler.sendReferrer(referrer, clickTime); + } + } + + public void setOfflineMode(boolean enabled) { + if (!checkActivityHandler()) return; + activityHandler.setOfflineMode(enabled); + } + + private boolean checkActivityHandler() { + if (activityHandler == null) { + getLogger().error("Please initialize Adjust by calling 'onCreate' before"); + return false; + } else { + return true; + } + } +} |