Skip to content

Getting Started

Terminal window
bun add @capgo/capacitor-firebase-crashlytics
bunx cap sync
import { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';

Forces a crash to test the implementation.

Only available for Android and iOS.

import { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
await FirebaseCrashlytics.crash({} as CrashOptions);

Sets a custom key and value that is associated with subsequent fatal and non-fatal reports.

Only available for Android and iOS.

import { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
await FirebaseCrashlytics.setCustomKey({} as SetCustomKeyOptions);

Sets a user ID (identifier) that is associated with subsequent fatal and non-fatal reports.

Only available for Android and iOS.

import { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
await FirebaseCrashlytics.setUserId({} as SetUserIdOptions);

Adds a custom log message that is sent with your crash data to give yourself more context for the events leading up to a crash.

Only available for Android and iOS.

import { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
await FirebaseCrashlytics.log({} as LogOptions);

Enables/disables automatic data collection. The value does not apply until the next run of the app.

Only available for Android and iOS.

import { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
await FirebaseCrashlytics.setEnabled({} as SetEnabledOptions);

Returns whether or not automatic data collection is enabled.

Only available for iOS.

import { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
await FirebaseCrashlytics.isEnabled();

Returns whether the app crashed during the previous execution.

Only available for Android and iOS.

import { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
await FirebaseCrashlytics.didCrashOnPreviousExecution();

Uploads any unsent reports to Crashlytics at next startup.

When automatic data collection is enabled, Crashlytics automatically uploads reports at startup.

Only available for Android and iOS.

import { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
await FirebaseCrashlytics.sendUnsentReports();

Deletes any unsent reports on the device.

Only available for Android and iOS.

import { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
await FirebaseCrashlytics.deleteUnsentReports();

Records a non-fatal report to send to Crashlytics.

Only available for Android and iOS.

import { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
await FirebaseCrashlytics.recordException({} as RecordExceptionOptions);
export interface CrashOptions {
/**
* @since 0.1.0
*/
message: string;
}
export type SetCustomKeyOptions = CustomKeyAndValue;
export interface SetUserIdOptions {
/**
* @since 0.1.0
*/
userId: string;
}
export interface LogOptions {
/**
* @since 0.1.0
*/
message: string;
}
export interface SetEnabledOptions {
/**
* @since 0.1.0
*/
enabled: boolean;
}
export interface IsEnabledResult {
/**
* @since 0.1.0
*/
enabled: boolean;
}
export interface DidCrashOnPreviousExecutionResult {
/**
* @since 0.1.0
*/
crashed: boolean;
}
export interface RecordExceptionOptions {
/**
* The message to record as a non-fatal exception.
*
* @since 0.1.0
*/
message: string;
/**
* Error code within a specific error domain.
*
* **Attention:** This option is ignored on iOS if `stacktrace` is provided.
*
* Only available for iOS.
*
* @since 0.1.0
*/
code?: number;
/**
* A string containing the error domain.
*
* **Attention:** This option is ignored on iOS if `stacktrace` is provided.
*
* Only available for iOS.
*
* @since 0.1.0
*/
domain?: string;
/**
* An array of keys and the values to associate with the non fatal exception,
* in addition to the app level custom keys.
*
* **Attention:** This option is ignored on iOS if `stacktrace` is provided.
*
* @since 7.1.0
*/
keysAndValues?: CustomKeyAndValue[];
/**
* A stacktrace generated by stacktrace.js.
*
* @since 1.1.0
*/
stacktrace?: StackFrame[];
}
export interface GetPluginVersionResult {
/**
* The semantic version of this plugin.
*
* @since 8.0.2
*/
version: string;
}
export interface CustomKeyAndValue {
/**
* @since 7.1.0
*/
key: string;
/**
* @since 7.1.0
*/
value: string | number | boolean;
/**
* @since 7.1.0
*/
type: 'string' | 'long' | 'double' | 'boolean' | 'int' | 'float';
}

Subset of the Stacktrace generated by stacktrace.js.

export interface StackFrame {
lineNumber?: number;
fileName?: string;
functionName?: string;
}

This page is generated from the plugin’s src/definitions.ts. Re-run the sync when the public API changes upstream.

If you are using Getting Started to plan dashboard and API operations, connect it with API Overview for the implementation detail in API Overview, Introduction for the implementation detail in Introduction, API Keys for the implementation detail in API Keys, Devices for the implementation detail in Devices, and Bundles for the implementation detail in Bundles.