From c28cc5b3b9736d92abff5005047b94f884b795e1 Mon Sep 17 00:00:00 2001 From: Martin <13046765170@163.com> Date: Thu, 8 Aug 2024 17:06:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20Adjust=20=E5=9F=8B?= =?UTF-8?q?=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/shayu/phonelive/AppContext.java | 9 +++++++++ common/build.gradle | 6 ++++++ common/proguard-rules.pro | 16 +++++++++++++++- .../yunbao/main/activity/RegisterActivity.java | 5 +++++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java index 14a180efe..57c14fe4e 100644 --- a/app/src/main/java/com/shayu/phonelive/AppContext.java +++ b/app/src/main/java/com/shayu/phonelive/AppContext.java @@ -21,6 +21,9 @@ import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import com.adjust.sdk.Adjust; +import com.adjust.sdk.AdjustConfig; +import com.adjust.sdk.LogLevel; import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; @@ -443,6 +446,12 @@ public class AppContext extends CommonAppContext { configSPApp(); //初始化美颜SDK // FaceManager.initFaceUnity(this); + //初始化Adjust + String appToken = "d6m0zj5a3k00"; + String environment = AdjustConfig.ENVIRONMENT_SANDBOX; + AdjustConfig config = new AdjustConfig(this, appToken, environment); + config.setLogLevel(LogLevel.VERBOSE); + Adjust.onCreate(config); } /** diff --git a/common/build.gradle b/common/build.gradle index 907facb14..1fa72ed86 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -264,4 +264,10 @@ dependencies { //下标切换器 https://github.com/angcyo/DslTabLayout api project(':TabLayout') + + //Adjust SDK + api 'com.adjust.sdk:adjust-android:4.38.5' + api 'com.android.installreferrer:installreferrer:2.2' + // Add the following if you're using the Adjust SDK inside web views on your app + api 'com.adjust.sdk:adjust-android-webbridge:4.38.5' } diff --git a/common/proguard-rules.pro b/common/proguard-rules.pro index cc79a578a..c58339bea 100644 --- a/common/proguard-rules.pro +++ b/common/proguard-rules.pro @@ -28,4 +28,18 @@ -ignorewarnings -keep class com.qiniu.**{*;} -keep class com.qiniu.**{public ();} --ignorewarnings \ No newline at end of file +-ignorewarnings + +#adjust.sdk +-keep class com.adjust.sdk.** { *; } +-keep class com.google.android.gms.common.ConnectionResult { + int SUCCESS; +} +-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient { + com.google.android.gms.ads.identifier.AdvertisingIdClient$Info getAdvertisingIdInfo(android.content.Context); +} +-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info { + java.lang.String getId(); + boolean isLimitAdTrackingEnabled(); +} +-keep public class com.android.installreferrer.** { *; } \ No newline at end of file diff --git a/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java b/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java index 8e6a13fbc..c2f6e87ea 100644 --- a/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java @@ -21,6 +21,8 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; +import com.adjust.sdk.Adjust; +import com.adjust.sdk.AdjustEvent; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.blankj.utilcode.util.DeviceUtils; @@ -374,6 +376,9 @@ public class RegisterActivity extends AbsActivity { public void onSuccess(int code, String msg, String[] info) { if (code == 0) { //注册成功 + //注册埋点 + AdjustEvent adjustEvent = new AdjustEvent("h9yurf"); + Adjust.trackEvent(adjustEvent); login(phoneNum, pwd, mUuidDevice); OpenInstall.reportRegister(); } else {