Beispiel #1
0
        public void GetNativeSessionFailure(string sessionFailureData)
        {
            if (IsEditor())
            {
                return;
            }

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

            var sessionFailure = new AdTraceSessionFailure(sessionFailureData);

            AdTrace.sessionFailureDelegate(sessionFailure);
        }
            // Method must be lowercase to match Android method signature.
            public void onFinishedSessionTrackingFailed(AndroidJavaObject sessionFailureData)
            {
                if (callback == null)
                {
                    return;
                }
                if (sessionFailureData == null)
                {
                    return;
                }

                AdTraceSessionFailure adtraceSessionFailure = new AdTraceSessionFailure();

                adtraceSessionFailure.Adid = sessionFailureData.Get <string>(AdTraceUtils.KeyAdid) == "" ?
                                             null : sessionFailureData.Get <string>(AdTraceUtils.KeyAdid);
                adtraceSessionFailure.Message = sessionFailureData.Get <string>(AdTraceUtils.KeyMessage) == "" ?
                                                null : sessionFailureData.Get <string>(AdTraceUtils.KeyMessage);
                adtraceSessionFailure.WillRetry = sessionFailureData.Get <bool>(AdTraceUtils.KeyWillRetry);
                adtraceSessionFailure.Timestamp = sessionFailureData.Get <string>(AdTraceUtils.KeyTimestamp) == "" ?
                                                  null : sessionFailureData.Get <string>(AdTraceUtils.KeyTimestamp);

                try
                {
                    AndroidJavaObject ajoJsonResponse    = sessionFailureData.Get <AndroidJavaObject>(AdTraceUtils.KeyJsonResponse);
                    string            jsonResponseString = ajoJsonResponse.Call <string>("toString");
                    adtraceSessionFailure.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(adtraceSessionFailure);
            }