/// <summary> /// Report uncaught C# Exception's as crashes (red blips) iff value is true . /// </summary> public static void SetLogUnhandledExceptionAsCrash(bool value) { #if UNITY_IOS CrittercismIOS.SetLogUnhandledExceptionAsCrash(value); #elif UNITY_ANDROID CrittercismAndroid.SetLogUnhandledExceptionAsCrash(value); #endif }
// 유틸 : 크래시 래포트 설정 void SetCrittercism() { #if UNITY_ANDROID UnityEngine.Debug.LogFormat("Crittercism.DidCrashOnLastLoad = {0}", CrittercismAndroid.DidCrashOnLastLoad()); CrittercismAndroid.Init("20fb64bf760d44589b6aefeb6bcb220700555300"); CrittercismAndroid.SetLogUnhandledExceptionAsCrash(true); #elif UNITY_IPHONE || UNITY_IOS UnityEngine.Debug.LogFormat("Crittercism.DidCrashOnLastLoad = {0}", CrittercismIOS.DidCrashOnLastLoad()); CrittercismIOS.Init("7d02af2372694b93b84d75a999dd7dd400555300"); CrittercismIOS.SetLogUnhandledExceptionAsCrash(true); #endif }
// 유틸 : 크래시 래포트 설정 void SetCrittercism() { #if UNITY_EDITOR UnityEngine.Debug.LogFormat("AOS Crittercism : {0}", m_strAppKeyForAOS); UnityEngine.Debug.LogFormat("IOS Crittercism : {0}", m_strAppKeyForIOS); #elif UNITY_ANDROID UnityEngine.Debug.LogFormat("Crittercism.DidCrashOnLastLoad = {0}", CrittercismAndroid.DidCrashOnLastLoad()); CrittercismAndroid.Init(m_strAppKeyForAOS); CrittercismAndroid.SetLogUnhandledExceptionAsCrash(true); #elif UNITY_IPHONE || UNITY_IOS UnityEngine.Debug.LogFormat("Crittercism.DidCrashOnLastLoad = {0}", CrittercismIOS.DidCrashOnLastLoad()); CrittercismIOS.Init(m_strAppKeyForIOS); CrittercismIOS.SetLogUnhandledExceptionAsCrash(true); #endif }
private CrittercismTestGUI() { Debug.Log("DidCrashOnLastLoad: " + CrittercismAndroid.DidCrashOnLastLoad()); CrittercismAndroid.SetLogUnhandledExceptionAsCrash(true); }
public void OnGUI() { CrittercismAndroid.SetLogUnhandledExceptionAsCrash(true); GUIStyle customStyle = new GUIStyle(GUI.skin.button); customStyle.fontSize = 30; const int numberOfButtons = 12; int screenButtonHeight = Screen.height / numberOfButtons; if (GUI.Button(new Rect(0, 0, Screen.width, screenButtonHeight), "Set Username", customStyle)) { CrittercismAndroid.SetUsername("MommaCritter"); } if (GUI.Button(new Rect(0, screenButtonHeight, Screen.width, screenButtonHeight), "Set Metadata", customStyle)) { CrittercismAndroid.SetMetadata(new string[] { "Game Level", "Status" }, new string[] { "5", "Crashes a lot" }); } if (GUI.Button(new Rect(0, 2 * screenButtonHeight, Screen.width, screenButtonHeight), "Leave Breadcrumb", customStyle)) { CrittercismAndroid.LeaveBreadcrumb("BreadCrumb"); } if (GUI.Button(new Rect(0, 3 * screenButtonHeight, Screen.width, screenButtonHeight), "Log Network Request", customStyle)) { System.Random random = new System.Random(); string[] methods = new string[] { "GET", "POST", "HEAD", "PUT" }; string method = methods[random.Next(0, methods.Length)]; string uriString = uriStrings[random.Next(0, uriStrings.Length)]; if (random.Next(0, 2) == 1) { uriString = uriString + "?doYouLoveCrittercism=YES"; } // latency in milliseconds long latency = (long)Math.Floor(4000.0 * random.NextDouble()); long bytesRead = random.Next(0, 10000); long bytesSent = random.Next(0, 10000); int responseCode = 200; if (random.Next(0, 5) == 0) { // Some common response other than 200 == OK . int[] responseCodes = new int[] { 301, 308, 400, 401, 402, 403, 404, 405, 408, 500, 502, 503 }; responseCode = responseCodes[random.Next(0, responseCodes.Length)]; } Console.WriteLine("LogNetworkRequest: \"" + uriString + "\""); CrittercismAndroid.LogNetworkRequest( method, uriString, latency, bytesRead, bytesSent, (HttpStatusCode)responseCode, WebExceptionStatus.Success); } if (GUI.Button(new Rect(0, 4 * screenButtonHeight, Screen.width, screenButtonHeight), "C# Crash", customStyle)) { crashInnerException(); } if (GUI.Button(new Rect(0, 5 * screenButtonHeight, Screen.width, screenButtonHeight), "C# Handled Exception", customStyle)) { try { crashInnerException(); } catch (System.Exception e) { CrittercismAndroid.LogHandledException(e); } } if (GUI.Button(new Rect(0, 6 * screenButtonHeight, Screen.width, screenButtonHeight), "C# Null Pointer Exception", customStyle)) { try { causeNullPointerException(); } catch (Exception e) { CrittercismAndroid.LogHandledException(e); } } if (GUI.Button(new Rect(0, 7 * screenButtonHeight, Screen.width, screenButtonHeight), "Begin Transaction", customStyle)) { CrittercismAndroid.BeginTransaction("UnityAndroid"); } if (GUI.Button(new Rect(0, 8 * screenButtonHeight, Screen.width, screenButtonHeight), "End Transaction", customStyle)) { CrittercismAndroid.EndTransaction("UnityAndroid"); } if (GUI.Button(new Rect(0, 9 * screenButtonHeight, Screen.width, screenButtonHeight), "Fail Transaction", customStyle)) { CrittercismAndroid.FailTransaction("UnityAndroid"); } if (GUI.Button(new Rect(0, 10 * screenButtonHeight, Screen.width, screenButtonHeight), "Set Transaction Value", customStyle)) { CrittercismAndroid.SetTransactionValue("UnityAndroid", 500); } if (GUI.Button(new Rect(0, 11 * screenButtonHeight, Screen.width, screenButtonHeight), "Get Transaction Value", customStyle)) { int value = CrittercismAndroid.GetTransactionValue("UnityAndroid"); Debug.Log("TransactionValue is: " + value); } }
public static void SetLogUnhandledExceptionAsCrash(bool value) { CrittercismAndroid.SetLogUnhandledExceptionAsCrash(value); }