Need help upgrading to Ionic Framework 4.0? Get assistance with our Enterprise Migration Services EXPLORE NOW

Crashlytics

Improve this doc

API for interacting with the Crashlytics kit.

https://docs.fabric.io/crashlytics/index.html

Repo: https://www.npmjs.com/package/cordova-fabric-plugin

Installation

  1. Install the Cordova and Ionic Native plugins:
    $ ionic cordova plugin add cordova-fabric-plugin --variable FABRIC_API_KEY=XXX --variable FABRIC_API_SECRET=xxx
    $ npm install --save @ionic-native/fabric@4
    
  2. Add this plugin to your app's module

Supported platforms

Usage

import { Crashlytics } from '@ionic-native/fabric';


constructor(private crashlytics: Crashlytics) { }

...

try {
 await this.loadData();
} catch (e) {
 this.crashlytics.addLog("Error while loading data");
 this.crashlytics.sendNonFatalCrash(e.message || e);
}

Instance Members

addLog(message)

Add logging that will be sent with your crash data. This logging will not show up in the system.log and will only be visible in your Crashlytics dashboard.

Param Type Details
message string

sendCrash()

Used to simulate a native platform crash (useful for testing Crashlytics logging).

sendNonFatalCrash()

Used to log a non-fatal error message (Android only).

recordError()

Used to record a non-fatal error message (iOS only).

setUserIdentifier()

Sets the user’s identifier for logging to Crashlytics backend.

setUserName()

Sets the user’s name for logging to Crashlytics backend.

setUserEmail()

Sets the user’s email address for logging to Crashlytics backend.

setStringValueForKey()

Sets a custom key/value pair for logging to Crashlytics backend.

setIntValueForKey()

Sets a custom key/value pair for logging to Crashlytics backend.

setBoolValueForKey()

Sets a custom key/value pair for logging to Crashlytics backend.

setFloatValueForKey()

Sets a custom key/value pair for logging to Crashlytics backend.

API

Native

General