예제 #1
0
        public void GetNativeEventFailure(string eventFailureData)
        {
            if (IsEditor())
            {
                return;
            }

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

            var eventFailure = new AdTraceEventFailure(eventFailureData);

            AdTrace.eventFailureDelegate(eventFailure);
        }
예제 #2
0
            // Method must be lowercase to match Android method signature.
            public void onFinishedEventTrackingFailed(AndroidJavaObject eventFailureData)
            {
                if (callback == null)
                {
                    return;
                }
                if (eventFailureData == null)
                {
                    return;
                }

                AdTraceEventFailure adtraceEventFailure = new AdTraceEventFailure();

                adtraceEventFailure.Adid = eventFailureData.Get <string>(AdTraceUtils.KeyAdid) == "" ?
                                           null : eventFailureData.Get <string>(AdTraceUtils.KeyAdid);
                adtraceEventFailure.Message = eventFailureData.Get <string>(AdTraceUtils.KeyMessage) == "" ?
                                              null : eventFailureData.Get <string>(AdTraceUtils.KeyMessage);
                adtraceEventFailure.WillRetry = eventFailureData.Get <bool>(AdTraceUtils.KeyWillRetry);
                adtraceEventFailure.Timestamp = eventFailureData.Get <string>(AdTraceUtils.KeyTimestamp) == "" ?
                                                null : eventFailureData.Get <string>(AdTraceUtils.KeyTimestamp);
                adtraceEventFailure.EventToken = eventFailureData.Get <string>(AdTraceUtils.KeyEventToken) == "" ?
                                                 null : eventFailureData.Get <string>(AdTraceUtils.KeyEventToken);
                adtraceEventFailure.CallbackId = eventFailureData.Get <string>(AdTraceUtils.KeyCallbackId) == "" ?
                                                 null : eventFailureData.Get <string>(AdTraceUtils.KeyCallbackId);

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