Exemplo n.º 1
0
            // Method must be lowercase to match Android method signature.
            public void onFinishedSessionTrackingSucceeded(AndroidJavaObject sessionSuccessData)
            {
                if (callback == null)
                {
                    return;
                }
                if (sessionSuccessData == null)
                {
                    return;
                }

                AdTraceSessionSuccess adtraceSessionSuccess = new AdTraceSessionSuccess();

                adtraceSessionSuccess.Adid = sessionSuccessData.Get <string>(AdTraceUtils.KeyAdid) == "" ?
                                             null : sessionSuccessData.Get <string>(AdTraceUtils.KeyAdid);
                adtraceSessionSuccess.Message = sessionSuccessData.Get <string>(AdTraceUtils.KeyMessage) == "" ?
                                                null : sessionSuccessData.Get <string>(AdTraceUtils.KeyMessage);
                adtraceSessionSuccess.Timestamp = sessionSuccessData.Get <string>(AdTraceUtils.KeyTimestamp) == "" ?
                                                  null : sessionSuccessData.Get <string>(AdTraceUtils.KeyTimestamp);

                try
                {
                    AndroidJavaObject ajoJsonResponse    = sessionSuccessData.Get <AndroidJavaObject>(AdTraceUtils.KeyJsonResponse);
                    string            jsonResponseString = ajoJsonResponse.Call <string>("toString");
                    adtraceSessionSuccess.BuildJsonResponseFromString(jsonResponseString);
                }
                catch (Exception)
                {
                    // JSON response reading failed.
                    // Native Android SDK should send empty JSON object if none available as of v4.12.5.
                    // Native Android SDK added special logic to send Unity friendly values as of v4.15.0.
                }

                callback(adtraceSessionSuccess);
            }
Exemplo n.º 2
0
        public void GetNativeSessionSuccess(string sessionSuccessData)
        {
            if (IsEditor())
            {
                return;
            }

            if (AdTrace.sessionSuccessDelegate == null)
            {
                Debug.Log("AdTrace: Session success delegate was not set.");
                return;
            }

            var sessionSuccess = new AdTraceSessionSuccess(sessionSuccessData);

            AdTrace.sessionSuccessDelegate(sessionSuccess);
        }