はじめに
インストール手順とこのプラグインのフルマークダウンガイドを含むセットアッププロンプトをコピーします。
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 などの 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: Androidで未回答のタイムアウトをベストエフォートで要求extra: リスナー パayloadに反映されるアーキテクチャandroid.channelIdそしてandroid.channelName: AndroidのフルスクリーンIncomingCallアクティビティを要求android.showFullScreen: Androidの通知チャンネル設定ios.handleType: 選択generic,phoneNumber, またはemailAddressfor CallKit
アクティブなコールの管理
セクション「アクティブなコールの管理」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: __CAPGO_KEEP_0__ が返信されなかったtimeoutMs
各イベントには、正常化された call ペイロードと元の extra オブジェクトが含まれます。
プラットフォームに関する注意
「プラットフォームに関する注意」- セクション iOS ガイドを読む PushKit または APNs フローに CallKit を組み込む前に
- Android ガイドを読む Android 14 以降でフルスクリーン インテントに依存する前に Android 14 以降でフルスクリーン インテントに依存する前に
- ウェブはサポートされていません。