cordova-plugin-firebase-crash

Cordova plugin for Firebase Crashlytics

Usage no npm install needed!

<script type="module">
  import cordovaPluginFirebaseCrash from 'https://cdn.skypack.dev/cordova-plugin-firebase-crash';
</script>

README

Cordova plugin for Firebase Crashlytics

NPM version NPM downloads NPM total downloads PayPal donate Twitter

| Donate | Your help is appreciated. Create a PR, submit a bug or just grab me :beer: | |-|-|

Index

Supported Platforms

  • iOS
  • Android

Installation

$ cordova plugin add cordova-plugin-firebase-crash

If you get an error about CocoaPods being unable to find compatible versions, run

$ pod repo update

Use variables IOS_FIREBASE_POD_VERSION ANDROID_FIREBASE_CRASHLYTICS_VERSION to override dependency versions for Firebase SDKs:

$ cordova plugin add cordova-plugin-firebase-crash --variable IOS_FIREBASE_POD_VERSION="~> 8.8.0" --variable ANDROID_FIREBASE_CRASHLYTICS_VERSION="18.2.+"

Disable data collection

In some cases, you may wish to temporarily or permanently disable collection of crash data. You can set the value of variable FIREBASE_CRASHLYTICS_COLLECTION_ENABLED to false to prevent collecting any user data:

$ cordova plugin add cordova-plugin-firebase-crash --variable FIREBASE_CRASHLYTICS_COLLECTION_ENABLED=false

Later you can re-enable crashlytics (for instance after getting end-user consent) using method setEnabled.

Methods

Every method returns a promise that fulfills when a call was successful.

log(message)

Add logging that will be sent with your crash data in case of app crash. Compare Firebase documentation.

cordova.plugins.firebase.crashlytics.log("my custom log message");

logError(message)

Log non-fatal exceptions in addition to automatically reported app crashes. Compare Firebase documentation.

cordova.plugins.firebase.crashlytics.logError("my non-fatal exception message");

setUserId(userId)

Sets the user identifier property for crashlytics reporting. Compare Firebase documentation.

cordova.plugins.firebase.crashlytics.setUserId("12345");

setEnabled(enabled)

Sets whether crashlytics collection is enabled for this app on this device.

cordova.plugins.firebase.crashlytics.setEnabled(false);

setCustomKey(key, value)

Add custom key/value pairs to crashlytics report. Compare Firebase documentation.

cordova.plugins.firebase.crashlytics.setCustomKey("my-string-key", "test value");
cordova.plugins.firebase.crashlytics.setCustomKey("my-number-key", 123);
cordova.plugins.firebase.crashlytics.setCustomKey("my-boolean-key", true);