はじめに
このプラグインのインストール手順と完全なMarkdownガイドを含むセットアッププロンプトをコピー
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.
インストール
「Install」セクション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.手動セットアップを希望する場合は、以下のコマンドでプラグインをインストールし、下記のプラットフォーム別の手順に従ってください:
bun add @capgo/capacitor-firebase-crashlyticsnpx cap syncインポート
「Import」セクションimport { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';クイックスタート
「Quick start」セクションimport { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
await FirebaseCrashlytics.crash({ message: 'Hello from Capacitor' });例: setCustomKey
「例: setCustomKey」というタイトルのセクションimport { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
await FirebaseCrashlytics.setCustomKey({ key: 'key-123', value: 'value', type: 'string',});例: setUserId
「例: setUserId」というタイトルのセクションimport { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
await FirebaseCrashlytics.setUserId({ userId: 'user-id-123' });よくある落とし穴
「Common pitfalls」セクション- ネイティブ同期: 実行
npx cap syncプラグインのアップグレード後。 - 信頼できる情報源: 信頼する
src/definitions.tsGitHub リポジトリ内に
API の概要
「API 概要」セクションcrash
「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
「setUserId」セクションその後の致命的なエラーおよび非致命的なレポートに関連付けられるユーザーID(識別子)を設定します。
AndroidおよびiOSでのみ利用可能です。
import { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
await FirebaseCrashlytics.setUserId({ userId: 'user-id-123' });log
「log」セクションカスタムログメッセージを追加します。クラッシュ発生に至るまでのイベントのコンテキストを把握するために、クラッシュデータと共に送信されます。
AndroidおよびiOSでのみ利用可能です。
import { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';
await FirebaseCrashlytics.log({ message: 'Hello from Capacitor' });setEnabled
「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」セクション未送信のレポートを次回の起動時にCrashlyticsへアップロードします。
自動データ収集が有効な場合、Crashlyticsは起動時にレポートを自動的にアップロードします。
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
「DidCrashOnPreviousExecutionResult」セクションexport interface DidCrashOnPreviousExecutionResult { /** * @since 0.1.0 */ crashed: boolean;}RecordExceptionOptions
「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
「GetPluginVersionResult」セクションexport interface GetPluginVersionResult { /** * The semantic version of this plugin. * * @since 8.0.2 */ version: string;}CustomKeyAndValue
「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
「StackFrame」セクションstacktrace.js によって生成されたスタックトレースのサブセット
export interface StackFrame { lineNumber?: number; fileName?: string; functionName?: string;}信頼できる情報源
「信頼できる情報源」セクションこのページはプラグインの src/definitions.tsから生成されています。上流で公開 API が変更されたら、sync を再実行してください。
Getting Started から続ける
「Getting Started からの続き」セクション以下を使用している場合: はじめに ダッシュボードと API の操作を計画するには、以下と連携してください API の概要 API Overview の実装の詳細については、 はじめに Introduction の実装の詳細については、 API キー API Keys の実装の詳細については、 デバイス Devices の実装の詳細、および バンドル Bundles の実装の詳細については、