【数数】尝试使用数数的设备id

dev_chengFeng
gaoxin 2021-01-20 15:34:33 +08:00
parent 47a90b60c5
commit 606b98aadd
5 changed files with 37 additions and 3 deletions

View File

@ -120,6 +120,11 @@ namespace GameLogic
ThinkingAnalyticsAPI.Track(trackEvent, data);
}
// 设置访客Id
public string GetDeviceId()
{
return ThinkingAnalyticsAPI.GetDeviceId();
}
// Debug.Log("TA.TAExample - current disctinct ID is: " + ThinkingAnalyticsAPI.GetDistinctId());

View File

@ -68,6 +68,17 @@ function this.GetDistinctId()
end
return ""
end
-- 获取设备Id
function this.GetDeviceId()
if AppConst.isSDK then
if App.TAMgr.GetDeviceID then
return App.TAMgr:GetDeviceId()
end
return AndroidDeviceInfo.Instance:GetDeviceID()
end
return ""
end
-- 登录
function this.Login(accountId)

View File

@ -49,7 +49,7 @@ function this.Initialize()
account = AppConst.isSDK and tostring(AppConst.OpenId) or "",
Bundle_id = AppConst.isSDK and AppConst.SdkPackageName or "",
xx_id = AppConst.isSDK and AppConst.SdkChannel or "",
device_id = AppConst.isSDK and AndroidDeviceInfo.Instance:GetDeviceID() or ""
device_id = AppConst.isSDK and ThinkingAnalyticsManager.GetDeviceId() or ""
})
ThinkingAnalyticsManager.Track("create_account")
end

View File

@ -33,7 +33,7 @@ end
--请求登录
function this.LoginRequest(openId, func)
local data = PlayerInfoProto_pb.LoginRequest()
data.device_id_s = AppConst.isSDK and AndroidDeviceInfo.Instance:GetDeviceID() or ""
data.device_id_s = AppConst.isSDK and ThinkingAnalyticsManager.GetDeviceId() or ""
data.idfa_sOr_imei_s = AppConst.isSDK and AndroidDeviceInfo.Instance:GetIMEICode() or ""
data.brand_type_s = AppConst.isSDK and AndroidDeviceInfo.Instance:GetDeviceBrand() or ""
data.brand_s = AppConst.isSDK and AndroidDeviceInfo.Instance:GetDeviceModel() or ""

View File

@ -17,6 +17,7 @@ public class GameLogic_ThinkingAnalyticsManagerWrap
L.RegFunction("SetSuperProperties", SetSuperProperties);
L.RegFunction("ClearSuperProperties", ClearSuperProperties);
L.RegFunction("Track", Track);
L.RegFunction("GetDeviceId", GetDeviceId);
L.RegFunction("__eq", op_Equality);
L.RegFunction("__tostring", ToLua.op_ToString);
L.EndClass();
@ -190,6 +191,23 @@ public class GameLogic_ThinkingAnalyticsManagerWrap
}
}
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int GetDeviceId(IntPtr L)
{
try
{
ToLua.CheckArgsCount(L, 1);
GameLogic.ThinkingAnalyticsManager obj = (GameLogic.ThinkingAnalyticsManager)ToLua.CheckObject<GameLogic.ThinkingAnalyticsManager>(L, 1);
string o = obj.GetDeviceId();
LuaDLL.lua_pushstring(L, o);
return 1;
}
catch (Exception e)
{
return LuaDLL.toluaL_exception(L, e);
}
}
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int op_Equality(IntPtr L)
{