はじめに
インストール
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-firebase-crashlytics`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/firebase-crashlytics/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
インストール
「インストール」のセクションCapgoのAIアシストセットアップを使用してプラグインをインストールできます。AIツールにCapgoスキルを追加するには、以下のコマンドを実行してください。
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins次に、以下のプロンプトを使用してください。
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-firebase-crashlytics` plugin in my project.Manualセットアップを使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください。
bun add @capgo/capacitor-firebase-crashlyticsbunx cap syncインポート
「インポート」のセクションimport { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';API オーバービュー
「API オーバービュー」のセクションcrash
「クラッシュ」のセクションクラッシュを強制して実装をテストします。
AndroidとiOSのみで利用可能です。
import { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
await FirebaseCrashlytics.crash({ message: 'Hello from Capacitor' });setCustomKey
「setCustomKey」のセクションfatalおよびnon-fatalレポートに関連付けられたカスタムキーと値を設定します。
AndroidとiOSのみで利用可能です。
import { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
await FirebaseCrashlytics.setCustomKey({ key: 'key-123', value: 'value', type: 'string',});setUserId
ユーザーIDの設定ユーザーIDを設定すると、次の致命的および非致命的レポートと関連付けられます。
AndroidおよびiOSのみ
import { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
await FirebaseCrashlytics.setUserId({ userId: 'user-id-123' });log
ログログメッセージを追加して、クラッシュデータとともに送信します。
AndroidおよびiOSのみ
import { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
await FirebaseCrashlytics.log({ message: 'Hello from Capacitor' });setEnabled
自動データ収集の有効/無効値は、次のアプリの実行まで適用されません。
AndroidおよびiOSのみ
import { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
await FirebaseCrashlytics.setEnabled({ enabled: true });isEnabled
「isEnabled」セクション自動データ収集の有効/無効を返します。
iOSのみ
import { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
const result = await FirebaseCrashlytics.isEnabled();console.log(result);didCrashOnPreviousExecution
「didCrashOnPreviousExecution」セクション前回実行時アプリがクラッシュしたかどうかを返します。
AndroidおよびiOSのみ
import { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
const result = await FirebaseCrashlytics.didCrashOnPreviousExecution();console.log(result);sendUnsentReports
「sendUnsentReports」セクション起動時に未送信のレポートをクラッシュリトルティクスにアップロードします。
自動データ収集が有効の場合、クラッシュリトルティクスは起動時にレポートを自動的にアップロードします。
AndroidおよびiOSのみで利用可能です。
import { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
await FirebaseCrashlytics.sendUnsentReports();deleteUnsentReports
「deleteUnsentReports」セクションデバイス上の未送信レポートをすべて削除します。
AndroidおよびiOSのみで利用可能です。
import { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
await FirebaseCrashlytics.deleteUnsentReports();recordException
「recordException」セクション非致死的なレポートをCrashlyticsに送信するために記録します。
AndroidおよびiOSのみで利用可能です。
import { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
await FirebaseCrashlytics.recordException({ message: 'Hello from Capacitor' });型参照
「型参照」セクションCrashOptions
セクション「CrashOptions」export interface CrashOptions { /** * @since 0.1.0 */ message: string;}SetCustomKeyOptions
セクション「SetCustomKeyOptions」export type SetCustomKeyOptions = CustomKeyAndValue;SetUserIdOptions
セクション「SetUserIdOptions」export interface SetUserIdOptions { /** * @since 0.1.0 */ userId: string;}LogOptions
セクション「LogOptions」export interface LogOptions { /** * @since 0.1.0 */ message: string;}SetEnabledOptions
セクション「SetEnabledOptions」export interface SetEnabledOptions { /** * @since 0.1.0 */ enabled: boolean;}IsEnabledResult
セクション「IsEnabledResult」export interface IsEnabledResult { /** * @since 0.1.0 */ enabled: boolean;}DidCrashOnPreviousExecutionResult
Section titled “前回実行でエラーが発生した場合の結果”export interface DidCrashOnPreviousExecutionResult { /** * @since 0.1.0 */ crashed: boolean;}RecordExceptionOptions
Section titled “エラーのレコードオプション”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 “プラグインのバージョンを取得する結果”export interface GetPluginVersionResult { /** * The semantic version of this plugin. * * @since 8.0.2 */ version: string;}CustomKeyAndValue
Section titled “カスタムキーと値”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 “スタックフレーム”スタックトレースを生成する stacktrace.js のサブセット。
export interface StackFrame { lineNumber?: number; fileName?: string; functionName?: string;}真実の源
「ソース オブ トゥルース」このページはプラグインから生成されています。 src/definitions.tsAPI のアップストリーム変更時は、再度同期を実行してください。
Getting Started から続けてください。
「Getting Started から続けてください。」あなたが使用している場合 はじめに 計画ダッシュボードと API の実行を計画する場合、API Overview API API Overview Introduction を参照してください。 API キー API キーの実装詳細のため デバイス デバイスの実装詳細のため バンドル バンドルの実装詳細のため