スタートガイド
インストール手順と、このプラグインの完全な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.
インストール
「インストール」セクション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 { FirebaseCrashlytics } from '@capgo/capacitor-firebase-crashlytics';クイックスタート
「クイックスタート」セクション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' });よくある落とし穴
「よくある落とし穴」セクション- ネイティブ同期: 実行
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」以降の致命的/非致命的レポートに紐付けるカスタムキーと値を設定します。
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;}Source of Truth
「Source Of Truth」セクションこのページはプラグインの src/definitions.tsから生成されています。upstream で公開 API が変更されたら、再度 sync を実行してください。
Getting Startedの続きを進める
「Getting Started からの続き」セクション使用している場合 スタートガイド ダッシュボードと API の運用を計画するには、これを次と連携させます API の概要 「API の概要」の実装の詳細については、 はじめに 「はじめに」における実装の詳細については、 API キー API Keys の実装の詳細については、 デバイス Devices の実装詳細については、および Bundle Bundlesの実装詳細については