Getting Started
Questo contenuto non è ancora disponibile nella tua lingua.
Install
Section titled “Install”bun add @capgo/capacitor-firebase-crashlyticsbunx cap syncImport
Section titled “Import”import { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';API Overview
Section titled “API Overview”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);setCustomKey
Section titled “setCustomKey”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);setUserId
Section titled “setUserId”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);setEnabled
Section titled “setEnabled”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);isEnabled
Section titled “isEnabled”Returns whether or not automatic data collection is enabled.
Only available for iOS.
import { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
await FirebaseCrashlytics.isEnabled();didCrashOnPreviousExecution
Section titled “didCrashOnPreviousExecution”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();sendUnsentReports
Section titled “sendUnsentReports”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();deleteUnsentReports
Section titled “deleteUnsentReports”Deletes any unsent reports on the device.
Only available for Android and iOS.
import { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
await FirebaseCrashlytics.deleteUnsentReports();recordException
Section titled “recordException”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);Type Reference
Section titled “Type Reference”CrashOptions
Section titled “CrashOptions”export interface CrashOptions { /** * @since 0.1.0 */ message: string;}SetCustomKeyOptions
Section titled “SetCustomKeyOptions”export type SetCustomKeyOptions = CustomKeyAndValue;SetUserIdOptions
Section titled “SetUserIdOptions”export interface SetUserIdOptions { /** * @since 0.1.0 */ userId: string;}LogOptions
Section titled “LogOptions”export interface LogOptions { /** * @since 0.1.0 */ message: string;}SetEnabledOptions
Section titled “SetEnabledOptions”export interface SetEnabledOptions { /** * @since 0.1.0 */ enabled: boolean;}IsEnabledResult
Section titled “IsEnabledResult”export interface IsEnabledResult { /** * @since 0.1.0 */ enabled: boolean;}DidCrashOnPreviousExecutionResult
Section titled “DidCrashOnPreviousExecutionResult”export interface DidCrashOnPreviousExecutionResult { /** * @since 0.1.0 */ crashed: boolean;}RecordExceptionOptions
Section titled “RecordExceptionOptions”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[];}GetPluginVersionResult
Section titled “GetPluginVersionResult”export interface GetPluginVersionResult { /** * The semantic version of this plugin. * * @since 8.0.2 */ version: string;}CustomKeyAndValue
Section titled “CustomKeyAndValue”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';}StackFrame
Section titled “StackFrame”Subset of the Stacktrace generated by stacktrace.js.
export interface StackFrame { lineNumber?: number; fileName?: string; functionName?: string;}Source Of Truth
Section titled “Source Of Truth”This page is generated from the plugin’s src/definitions.ts. Re-run the sync when the public API changes upstream.