A cross platform plugin for Firebase Crashlytics. A wrapper for Xamarin.Firebase.iOS.Crashlytics and the binding library of firebase-crashlytics.
Install Nuget package to each projects.
- Add GoogleService-Info.plist to iOS project. Select BundleResource as build action.
- Initialize as follows in AppDelegate.
Firebase.Core.App.Configure();
- Refer to Xamarin.Firebase.iOS.Crashlytics for more information.
- Add google-services.json to Android project. Select GoogleServicesJson as build action. (If you can't select GoogleServicesJson, reload this android project.)
- Target framework version needs to be Android 10.0.
- Create a string resource with the name
com.crashlytics.android.build_id
. The value can be whatever you want to uniquely identify a particular build with.
<string name="com.crashlytics.android.build_id">1.0</string>
CrossFirebaseCrashlytics.Current.Log("hoge")
// bool
CrossFirebaseCrashlytics.Current.SetCustomKey(key, true);
// int
CrossFirebaseCrashlytics.Current.SetCustomKey(key, 1);
// long
CrossFirebaseCrashlytics.Current.SetCustomKey(key, 1L);
// float
CrossFirebaseCrashlytics.Current.SetCustomKey(key, 1.0f);
// double
CrossFirebaseCrashlytics.Current.SetCustomKey(key, 1.0);
// string
CrossFirebaseCrashlytics.Current.SetCustomKey(key, "foo");
CrossFirebaseCrashlytics.Current.SetUserIdentifier("id");
CrossFirebaseCrashlytics.Current.RecordException(exception);
you can handle uncaught exceptions for sending the stack trace to Crashlytics. If the argument shouldThrowFormattedException
is true, it rethrows the formatted exception (CrashlyticsException
), otherwise it calls RecordException
on Android. It calls RecordException
regardless of the argument on iOS.
CrossFirebaseCrashlytics.Current.HandleUncaughtException();