update: [中台] 设备信息上报附加用户 Token 上报接口

deeplink
胡宇飞 2024-04-28 17:49:36 +08:00
parent bba3d61ce0
commit 8100628320
6 changed files with 43 additions and 5 deletions

View File

@ -39,7 +39,7 @@ namespace Guru
return _adjustId; // Adjust AdId;
}
}
#region 启动服务
/// <summary>

View File

@ -61,7 +61,6 @@ namespace Guru
// ------- 初始化自打点 ----------
InstallGuruAnalytics(IsDebug);
if (_defaultEventSetting == null)
{
var analyticsSetting = GuruSettings.Instance.AnalyticsSetting;

View File

@ -120,6 +120,8 @@ namespace Guru
string fbAppId = GuruSettings.Instance.IPMSetting.FacebookAppId;
AdjustService.StartService(appToken, fbAppId);
});
}

View File

@ -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);
}
}
}

View File

@ -1,10 +1,18 @@
using System;
using UnityEngine.Device;
namespace Guru
{
/// <summary>
/// 设备数据
/// </summary>
[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}";
}
}
}

View File

@ -5,6 +5,11 @@ using UnityEngine.Networking;
namespace Guru
{
/// <summary>
/// 接口文档参见:
/// 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
/// </summary>
public class DeviceInfoUploadRequest : RequestBase
{
protected override string RequestURL => IPMConfig.IPM_URL + "device/api/v1/devices";