From 337bbe7ec3f847ce71b4d9fe5229abcab9359376 Mon Sep 17 00:00:00 2001 From: juntao Date: Tue, 18 Jan 2022 15:11:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=90=AF=E5=8A=A8=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E4=B8=8A=E6=8A=A5=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/com/gh/common/util/DeviceTokenUtils.kt | 7 +++++-- app/src/main/java/com/gh/gamecenter/MainActivity.java | 2 +- .../main/java/com/gh/gamecenter/SplashScreenActivity.java | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/gh/common/util/DeviceTokenUtils.kt b/app/src/main/java/com/gh/common/util/DeviceTokenUtils.kt index cd181e700c..63113b78e5 100644 --- a/app/src/main/java/com/gh/common/util/DeviceTokenUtils.kt +++ b/app/src/main/java/com/gh/common/util/DeviceTokenUtils.kt @@ -39,7 +39,7 @@ object DeviceTokenUtils { } @JvmStatic - fun getLaunchType(): LunchType { + fun getLaunchType(readOnly: Boolean = false): LunchType { var lunchType: LunchType? = null val values = PreferenceManager.getDefaultSharedPreferences(HaloApp.getInstance().application).all // 版本更新 @@ -64,7 +64,10 @@ object DeviceTokenUtils { if (deviceId.isNullOrEmpty()) { deviceId = Utils.getTime(HaloApp.getInstance().application).toString() } - setDeviceId(deviceId) + + if (!readOnly) { + setDeviceId(deviceId) + } return lunchType } diff --git a/app/src/main/java/com/gh/gamecenter/MainActivity.java b/app/src/main/java/com/gh/gamecenter/MainActivity.java index 4f903a6ad8..9994d5f6db 100644 --- a/app/src/main/java/com/gh/gamecenter/MainActivity.java +++ b/app/src/main/java/com/gh/gamecenter/MainActivity.java @@ -200,7 +200,7 @@ public class MainActivity extends BaseActivity { isNewFirstLaunch = mSp.getBoolean("isNewFirstLaunchV" + PackageUtils.getGhVersionName(), true); if (isNewFirstLaunch) { - final LunchType lunchType = DeviceTokenUtils.getLaunchType(); + final LunchType lunchType = DeviceTokenUtils.getLaunchType(false); // 延时两秒提交,避免提交时还没获取到 GID/OAID AppExecutor.getUiExecutor().executeWithDelay(() -> { if (!this.isFinishing()) { diff --git a/app/src/main/java/com/gh/gamecenter/SplashScreenActivity.java b/app/src/main/java/com/gh/gamecenter/SplashScreenActivity.java index 0c85846024..fff5077ad0 100644 --- a/app/src/main/java/com/gh/gamecenter/SplashScreenActivity.java +++ b/app/src/main/java/com/gh/gamecenter/SplashScreenActivity.java @@ -295,7 +295,7 @@ public class SplashScreenActivity extends BaseActivity { HaloApp.getInstance().setLocalTemporaryDeviceId(localTemporaryDeviceId); SPUtils.setString(Constants.SP_TEMPORARY_DEVICE_ID, localTemporaryDeviceId); } - map.put("launch_type", DeviceTokenUtils.getLaunchType().name()); + map.put("launch_type", DeviceTokenUtils.getLaunchType(true).name()); } else if (HaloApp.getInstance().isReinstallTheSameVersion) { map.put("launch_type", LunchType.UPDATE.toString()); }