示例#1
0
    public void Init()
    {
        //GooglePlay以外平台如amzon平台,发布时需要调用该api
#if UNITY_ANDROID && !UNITY_EDITOR
        UPTraceApi.setCustomerIdForAndroid(GetAndroidID());
#endif

        //欧盟用户展示gdpr弹窗,并在用户拒绝时调用disableAccessPrivacyInformation()
        //UPTraceApi.disableAccessPrivacyInformation();

        //正式包请关闭该debug
        UPTraceApi.enalbeDebugMode(true);

        //init TraceSDK
        UPTraceApi.initTraceSDK(PRODUCTID, CHANNELID);

        //在线时长上报
        OnlineReport();


        //appsflyer
        AppsFlyer.setIsDebug(true);

        AppsFlyer.initSDK(AF_DEV_KEY, AF_APPID, this);


        //iOS 延迟调用上报,目的是确保首次上报在ATT弹窗获得结果之后
#if UNITY_IOS && !UNITY_EDITOR
        AppsFlyeriOS.waitForATTUserAuthorizationWithTimeoutInterval(60);
#endif
        AppsFlyer.startSDK();
    }
示例#2
0
    //AF归因回调--start
    public void onConversionDataSuccess(string conversionData)
    {
        AppsFlyer.AFLog("onConversionDataSuccess", conversionData);
        Dictionary <string, object> conversionDataDictionary = AppsFlyer.CallbackStringToDictionary(conversionData);

        // add deferred deeplink logic here


        // 在这里获取 AvidlyTraceSDK 用户标签
        UPTraceApi.getConversionData(conversionData,
                                     new System.Action <string>(onAvidlyConversionDataSuccess),
                                     new System.Action <string>(onAvidlyConversionDataFail)
                                     );
    }
示例#3
0
        public void initCall(string productId)
        {
            UPTraceApi.initTraceSDK(productId, "32401", UPTraceConstant.UPTraceSDKZoneEnum.UPTraceSDKZoneForeign);

            Debug.Log("===> call init in CSSDKcall");
            // 调用原生的方法
#if UNITY_IOS && !UNITY_EDITOR
            initForIosCssdk(productId);
#elif UNITY_ANDROID && !UNITY_EDITOR
            if (jc != null)
            {
                jc.CallStatic(JavaClassStaticMethod_init, productId);
            }
#endif
        }
示例#4
0
 //在此处调用这两个api来实现在线时长上报
 void OnApplicationPause(bool paused)
 {
     if (UPTraceApi.isTraceSDKInited())
     {
         if (paused)
         {
             //程序进入后台时执行
             UPTraceApi.resignActive();
         }
         else
         {
             //程序从后台进入前台时
             UPTraceApi.becomeActive();
         }
     }
 }
示例#5
0
    public void Update()
    {
        //AF 与AvidlyTraceSDK 互传,只设置一次,且确保拿到的不为空
        if (!HasSetAFID)
        {
            //获取 afid
            string afid = AppsFlyer.getAppsFlyerId();
            // 获取openId
            string openId = UPTraceApi.getOpenId();
            if (afid == null || afid == "" || openId == null || openId == "")
            {
                return;
            }
            Debug.Log("afid=" + afid);
            Debug.Log("openId=" + openId);

            // 将openId赋值给AppsFlyer
            AppsFlyer.setCustomerUserId(openId);
            // 将afid赋值给统计包
            UPTraceApi.setAFId(afid);

            HasSetAFID = true;
        }
    }
示例#6
0
 public void OnlineReport()
 {
     UPTraceApi.initDurationReport("test_server", "america", PLAYERID, "");
 }
示例#7
0
 public void GuestLogin()
 {
     UPTraceApi.guestLogin(PLAYERID);
 }
示例#8
0
 public void LogEvent()
 {
     UPTraceApi.traceKey("T01");
 }