コード例 #1
0
 public static void SetUserId(string id)
 {
     if (!setupReady)
     {
         return;
     }
     userId = id;
     Crashlytics.SetUserId(id);
     FirebaseAnalytics.SetUserId(id);
 }
コード例 #2
0
        // Try to SignIn Async
        void TrySignIn()
        {
            _auth.SignInAnonymouslyAsync().ContinueWith(task => {
                if (task.IsFaulted)
                {
                    Debug.LogWarning("Can't create user, retrying in " + (millisecondsToRetrySignIn / 1000f) + " seconds...");
                    Thread.Sleep(millisecondsToRetrySignIn);
                    var instanceCaller = new Thread(TrySignIn);
                    instanceCaller.Start();
                    return;
                }

                Persistence.Log("User created:" + task.Result.UserId);
                Crashlytics.SetUserId(task.Result.UserId);
            });
        }
コード例 #3
0
        /// <summary>
        /// Throw a random exception from the choices in this directory. Demonstrate
        /// a different set of functions based on which exception is chosen.
        /// </summary>
        /// <param name="message"></param>
        public static void Throw(String message)
        {
            if (FirebaseAuth.DefaultInstance.CurrentUser != null)
            {
                Crashlytics.SetUserId(FirebaseAuth.DefaultInstance.CurrentUser.UserId);
            }

            int exceptionIndex = RandomGenerator.Next(0, 6);

            switch (exceptionIndex)
            {
            case 0:
                Crashlytics.Log("Menu meltdown is imminent.");
                ThrowMenuMeltdown(message);
                break;

            case 1:
                Crashlytics.Log("User triggered another forced exception.");
                ThrowAnotherForcedException(message);
                break;

            case 2:
                Crashlytics.Log("User triggered an intentionally obscure exception.");
                ThrowIntentionallyObscureException();
                break;

            case 3:
                Crashlytics.Log("User triggered a random text exception.");
                ThrowRandomTextException(message);
                break;

            case 4:
                Crashlytics.Log("User triggered an equally statistically likely exception.");
                ThrowStatisticallyAsLikelyException(message);
                break;

            default:
                Crashlytics.Log(String.Format("Could not find index {0} - using default meltdown exception", exceptionIndex));
                ThrowMenuMeltdown(message);
                break;
            }
        }
コード例 #4
0
 // Set User Identifier for this Crashlytics session
 public void SetUserID(String id)
 {
     DebugLog("Setting Crashlytics user identifier: " + id);
     Crashlytics.SetUserId(id);
 }