はじめに
このプラグインのインストール手順と完全なマークダウンガイドを含むセットアッププロンプトをコピーしてください。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-incoming-call-kit`
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/incoming-call-kit/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.
-
パッケージをインストールする
ターミナル画面 bun add @capgo/capacitor-incoming-call-kit -
ネイティブプロジェクトを同期する
ターミナル画面 bunx cap sync -
RINGソースを選択する SDK から受信コールイベントが来るか、Twilio または Stream などの SDK から、または FCM または PushKit などのネイティブプッシュパスから来るかを決定する
統合の仕組み
統合の仕組みこのプラグインは、ネイティブの着信表示のみを所有します。アプリは、トランスポート、認証、実際のメディアセッションを所有します。
一般的なプロダクションパターンは:
- あなたのバックエンドまたは SDK がリングイベントを発行します。
- あなたのアプリが
showIncomingCall(). - プラグインは、受信コールのネイティブUIを提示します。
callAccepted実際のルームまたはVoIPセッションに参加するようにあなたのアプリに指示します。callDeclined,callEnded、またはcallTimedOutリモート状態をクリーンアップするようにあなたのアプリに指示します。
最小限の統合
「最小限の統合」import { IncomingCallKit } from '@capgo/capacitor-incoming-call-kit';
await IncomingCallKit.requestPermissions();await IncomingCallKit.requestFullScreenIntentPermission();
await IncomingCallKit.addListener('callAccepted', async ({ call }) => { console.log('Accepted', call.callId, call.extra); // Start or join your real call session here.});
await IncomingCallKit.addListener('callDeclined', ({ call }) => { console.log('Declined', call.callId); // Tell your backend or SDK that the user declined.});
await IncomingCallKit.addListener('callTimedOut', ({ call }) => { console.log('Timed out', call.callId); // Clear ringing state in your backend or SDK.});
await IncomingCallKit.showIncomingCall({ callId: 'call-42', callerName: 'Ada Lovelace', handle: '+39 555 010 020', appName: 'Capgo Phone', hasVideo: true, timeoutMs: 45_000, extra: { roomId: 'room-42', callerUserId: 'user_ada', }, android: { channelId: 'calls', channelName: 'Incoming Calls', showFullScreen: true, }, ios: { handleType: 'phoneNumber', },});重要なオプション
「重要なオプション」callId: 稼働中の識別子、後で再利用されるendCall()timeoutMs: 最善の努力で回答しないタイムアウトextra: リスナーパイロード内の任意のJSONがエコーされますandroid.channelIdそしてandroid.channelName: Android通知チャンネル調整android.showFullScreen: AndroidのフルスクリーンIncomingCallアクティビティを要求しますios.handleTypeを選択しますgeneric,phoneNumber、またはemailAddressCallKitのために
現在進行中のコールの管理
セクション「現在進行中のコールの管理」const { calls } = await IncomingCallKit.getActiveCalls();
await IncomingCallKit.endCall({ callId: 'call-42', reason: 'remote-ended',});
await IncomingCallKit.endAllCalls({ reason: 'session-reset',});イベントモデル
イベントモデルincomingCallDisplayed:ネイティブUIが正常に表示されましたcallAccepted:ユーザーがネイティブUIから承認されましたcallDeclined:ユーザーが参加前に拒否されましたcallEnded:アプリまたはプラットフォームがトラッキングされたコールを終了しましたcallTimedOut:コールは未回答のままtimeoutMs
各イベントには、正規化された call ペイロードと元の extra オブジェクトが含まれます。
プラットフォームの注記
セクション「プラットフォームの注記」- プラットフォームの注記を読んでください iOS ガイド __CAPGO_KEEP_0__
- Read the Android ガイド __CAPGO_KEEP_0__
- Web はサポートされていません。