public AnswersEventInstanceJavaObject(string eventType, Dictionary <string, object> customAttributes, params string[] args) { this.javaObject = new AndroidJavaObject(string.Format("com.crashlytics.android.answers.{0}", eventType), args); foreach (KeyValuePair <string, object> keyValuePair in customAttributes) { string key = keyValuePair.Key; object value = keyValuePair.Value; if (value == null) { UnityEngine.Debug.Log(string.Format("[Answers] Expected custom attribute value to be non-null. Received: {0}", value)); } else if (AnswersEventInstanceJavaObject.IsNumericType(value)) { this.javaObject.Call <AndroidJavaObject>("putCustomAttribute", new object[] { key, AnswersEventInstanceJavaObject.AsDouble(value) }); } else if (value is string) { this.javaObject.Call <AndroidJavaObject>("putCustomAttribute", new object[] { key, value }); } else { UnityEngine.Debug.Log(string.Format("[Answers] Expected custom attribute value to be a string or numeric. Received: {0}", value)); } } }
public void InvokeSafelyAsDouble(string methodName, object arg) { if (arg != null) { this.javaObject.Call <AndroidJavaObject>(methodName, new object[] { AnswersEventInstanceJavaObject.AsDouble(arg) }); } }
public AnswersEventInstanceJavaObject(string eventType, Dictionary <string, object> customAttributes, params string[] args) { this.javaObject = new AndroidJavaObject(string.Format("com.crashlytics.android.answers.{0}", (object)eventType), (object[])args); using (Dictionary <string, object> .Enumerator enumerator = customAttributes.GetEnumerator()) { while (enumerator.MoveNext()) { KeyValuePair <string, object> current = enumerator.Current; string key = current.Key; object o = current.Value; if (o == null) { Debug.Log((object)string.Format("[Answers] Expected custom attribute value to be non-null. Received: {0}", o)); } else if (AnswersEventInstanceJavaObject.IsNumericType(o)) { this.javaObject.Call <AndroidJavaObject>("putCustomAttribute", new object[2] { (object)key, (object)AnswersEventInstanceJavaObject.AsDouble(o) }); } else if (o is string) { this.javaObject.Call <AndroidJavaObject>("putCustomAttribute", new object[2] { (object)key, o }); } else { Debug.Log((object)string.Format("[Answers] Expected custom attribute value to be a string or numeric. Received: {0}", o)); } } } }