diff --git a/Runtime/GuruCore/Runtime/Adjust/AdjustService.cs b/Runtime/GuruCore/Runtime/Adjust/AdjustService.cs index cb1e7bc..1b32823 100644 --- a/Runtime/GuruCore/Runtime/Adjust/AdjustService.cs +++ b/Runtime/GuruCore/Runtime/Adjust/AdjustService.cs @@ -39,7 +39,7 @@ namespace Guru return _adjustId; // Adjust AdId; } } - + #region 启动服务 /// diff --git a/Runtime/GuruCore/Runtime/Analytics/Analytics.cs b/Runtime/GuruCore/Runtime/Analytics/Analytics.cs index 651b159..c599003 100644 --- a/Runtime/GuruCore/Runtime/Analytics/Analytics.cs +++ b/Runtime/GuruCore/Runtime/Analytics/Analytics.cs @@ -61,7 +61,6 @@ namespace Guru // ------- 初始化自打点 ---------- InstallGuruAnalytics(IsDebug); - if (_defaultEventSetting == null) { var analyticsSetting = GuruSettings.Instance.AnalyticsSetting; diff --git a/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.cs b/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.cs index 587a985..1d755a7 100644 --- a/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.cs +++ b/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.cs @@ -120,6 +120,8 @@ namespace Guru string fbAppId = GuruSettings.Instance.IPMSetting.FacebookAppId; AdjustService.StartService(appToken, fbAppId); }); + + } diff --git a/Runtime/GuruCore/Runtime/IPM/Scripts/IPMConfig.cs b/Runtime/GuruCore/Runtime/IPM/Scripts/IPMConfig.cs index f16236e..bf78da3 100644 --- a/Runtime/GuruCore/Runtime/IPM/Scripts/IPMConfig.cs +++ b/Runtime/GuruCore/Runtime/IPM/Scripts/IPMConfig.cs @@ -199,6 +199,11 @@ namespace Guru get => PlayerPrefs.GetString(nameof(FIREBASE_ID), ""); set => PlayerPrefs.SetString(nameof(FIREBASE_ID), value); } + public static string FIREBASE_APP_ID + { + get => PlayerPrefs.GetString(nameof(FIREBASE_APP_ID), ""); + set => PlayerPrefs.SetString(nameof(FIREBASE_APP_ID), value); + } public static string ADJUST_ID { @@ -218,6 +223,12 @@ namespace Guru get => PlayerPrefs.GetString(nameof(ADJUST_IDFA), ""); set => PlayerPrefs.SetString(nameof(ADJUST_IDFA), value); } + + public static string ADJUST_GPSADID + { + get => PlayerPrefs.GetString(nameof(ADJUST_GPSADID), ""); + set => PlayerPrefs.SetString(nameof(ADJUST_GPSADID), value); + } } } \ No newline at end of file diff --git a/Runtime/GuruCore/Runtime/IPM/Scripts/RequestData/DeviceData.cs b/Runtime/GuruCore/Runtime/IPM/Scripts/RequestData/DeviceData.cs index c8c5ad4..9ca0fd1 100644 --- a/Runtime/GuruCore/Runtime/IPM/Scripts/RequestData/DeviceData.cs +++ b/Runtime/GuruCore/Runtime/IPM/Scripts/RequestData/DeviceData.cs @@ -1,10 +1,18 @@ using System; +using UnityEngine.Device; namespace Guru { + + /// + /// 设备数据 + /// + [Serializable] public class DeviceData { + private const string PUSH_TYPE_FCM = "FCM"; + public string deviceId; //必填,设备唯一ID public string uid; //必填,用户唯一ID,授权结果返回的uid public string androidId; //android设备有效 @@ -21,31 +29,44 @@ namespace Guru public string model; //手机品牌下的手机型号 public string timezone; //必填,时区,用于按照当地时间发推送消息,如America/Chicago public bool pushNotificationEnable; //必填,默认true,发送消息的总开关 + public string firebaseAppInstanceId; // 可选, firebase应用实例id + public string idfa; // 可选, ios广告id + public string adid; // 可选, adjust id + public string gpsAdid; // 可选, android广告id public DeviceData() { DeviceUtil.GetDeviceInfo(); deviceId = IPMConfig.IPM_DEVICE_ID; uid = IPMConfig.IPM_UID; - androidId = IPMConfig.IPM_DEVICE_ID; + androidId = SystemInfo.deviceUniqueIdentifier; // Unity get AndroidID appCountry = IPMConfig.IPM_COUNTRY_CODE; deviceCountry = IPMConfig.IPM_COUNTRY_CODE; language = IPMConfig.IPM_LANGUAGE; locale = IPMConfig.IPM_LOCALE; deviceToken = IPMConfig.IPM_PUSH_TOKEN; deviceType = IPMConfig.GetDeviceType(); - pushType = "FCM"; + pushType = PUSH_TYPE_FCM; appIdentifier = IPMConfig.IPM_APP_PACKAGE_NAME; appVersion = IPMConfig.IPM_APP_VERSION; brand = IPMConfig.IPM_BRAND; model = IPMConfig.IPM_MODEL; timezone = IPMConfig.IPM_TIMEZONE; pushNotificationEnable = true; + firebaseAppInstanceId = IPMConfig.FIREBASE_ID; + idfa = IPMConfig.ADJUST_IDFA; + adid = IPMConfig.ADJUST_ADID; + gpsAdid = IPMConfig.ADJUST_GPSADID; } public override string ToString() { - return $"{nameof(deviceId)}: {deviceId}, {nameof(uid)}: {uid}, {nameof(androidId)}: {androidId}, {nameof(appCountry)}: {appCountry}, {nameof(deviceCountry)}: {deviceCountry}, {nameof(language)}: {language}, {nameof(locale)}: {locale}, {nameof(deviceToken)}: {deviceToken}, {nameof(deviceType)}: {deviceType}, {nameof(pushType)}: {pushType}, {nameof(appIdentifier)}: {appIdentifier}, {nameof(appVersion)}: {appVersion}, {nameof(brand)}: {brand}, {nameof(model)}: {model}, {nameof(timezone)}: {timezone}, {nameof(pushNotificationEnable)}: {pushNotificationEnable}"; + return $"{nameof(deviceId)}: {deviceId}, {nameof(uid)}: {uid}, " + + $"{nameof(androidId)}: {androidId}, {nameof(appCountry)}: {appCountry}, {nameof(deviceCountry)}: {deviceCountry}, " + + $"{nameof(language)}: {language}, {nameof(locale)}: {locale}, {nameof(deviceToken)}: {deviceToken}, {nameof(deviceType)}: {deviceType}, " + + $"{nameof(pushType)}: {pushType}, {nameof(appIdentifier)}: {appIdentifier}, {nameof(appVersion)}: {appVersion}, {nameof(brand)}: {brand}, " + + $"{nameof(model)}: {model}, {nameof(timezone)}: {timezone}, {nameof(pushNotificationEnable)}: {pushNotificationEnable}, " + + $"{nameof(firebaseAppInstanceId)}: {firebaseAppInstanceId}, {nameof(idfa)}: {idfa}, {nameof(adid)}: {adid}, {nameof(gpsAdid)}: {gpsAdid}"; } } } \ No newline at end of file diff --git a/Runtime/GuruCore/Runtime/IPM/Scripts/Requests/DeviceInfoUploadRequest.cs b/Runtime/GuruCore/Runtime/IPM/Scripts/Requests/DeviceInfoUploadRequest.cs index 0180945..7644f74 100644 --- a/Runtime/GuruCore/Runtime/IPM/Scripts/Requests/DeviceInfoUploadRequest.cs +++ b/Runtime/GuruCore/Runtime/IPM/Scripts/Requests/DeviceInfoUploadRequest.cs @@ -5,6 +5,11 @@ using UnityEngine.Networking; namespace Guru { + + /// + /// 接口文档参见: + /// https://github.com/castbox/backend-dev/blob/main/saas/%E4%B8%AD%E5%8F%B0%E6%9C%8D%E5%8A%A1%E6%8E%A5%E5%85%A5%E6%89%8B%E5%86%8C.md#531%E8%AE%BE%E5%A4%87%E6%95%B0%E6%8D%AE%E4%B8%8A%E6%8A%A5 + /// public class DeviceInfoUploadRequest : RequestBase { protected override string RequestURL => IPMConfig.IPM_URL + "device/api/v1/devices";