capacitor-incoming-call-kit
v0.1.2
Published
A Capacitor plugin to show incoming call in your Capacitor app(Custom for Android/Callkit for iOS)
Downloads
765
Maintainers
Readme
capacitor-incoming-call-kit
A Capacitor plugin to show incoming call in your Capacitor app(Custom for Android/Callkit for iOS)
This plugin is a modification of the Flutter plugin: flutter_callkit_incoming to suite a capacitor app so all credits goes to hiennguyen92
The plugin is has @capacitor/push-notifications version 6.0.2 integrated
Install
npm install capacitor-incoming-call-kit
npx cap sync
API
getInitialEvents()
clearInitialEvents()
addEventListener(...)
removeEventListener(...)
setup(...)
hasDefaultPhoneAccount()
answerIncomingCall(...)
registerPhoneAccount(...)
registerAndroidEvents()
unregisterAndroidEvents()
displayIncomingCall(...)
startCall(...)
updateDisplay(...)
checkPhoneAccountEnabled()
isConnectionServiceAvailable()
reportConnectedOutgoingCallWithUUID(...)
reportConnectingOutgoingCallWithUUID(...)
reportEndCallWithUUID(...)
rejectCall(...)
endCall(...)
endAllCalls()
setReachable()
setSettings(...)
isCallActive(...)
getCalls()
getAudioRoutes()
supportConnectionService()
hasPhoneAccount()
hasOutgoingCall()
setMutedCall(...)
toggleAudioRouteSpeaker(...)
setOnHold(...)
setConnectionState(...)
sendDTMF(...)
checkIfBusy()
checkSpeaker()
setAvailable(...)
setForegroundServiceSettings(...)
canMakeMultipleCalls(...)
setCurrentCallActive(...)
backToForeground()
checkIsInManagedCall()
- Interfaces
- Type Aliases
- Enums
getInitialEvents()
getInitialEvents() => Promise<InitialEvents>
Returns: Promise<InitialEvents>
clearInitialEvents()
clearInitialEvents() => void
addEventListener(...)
addEventListener<Event extends keyof NativeEvents>(type: Event, handler: (args: EventsPayload[Event]) => void) => EventListener
| Param | Type |
| ------------- | ---------------------------------------------------- |
| type
| Event |
| handler
| (args: EventsPayload[Event]) => void |
Returns: EventListener
removeEventListener(...)
removeEventListener(type: Events) => void
| Param | Type |
| ---------- | ----------------------------------------------------------- |
| type
| keyof NativeEvents |
setup(...)
setup(options: IOptions) => Promise<boolean>
| Param | Type |
| ------------- | --------------------------------------------- |
| options
| IOptions |
Returns: Promise<boolean>
hasDefaultPhoneAccount()
hasDefaultPhoneAccount() => boolean
Returns: boolean
answerIncomingCall(...)
answerIncomingCall(uuid: string) => void
| Param | Type |
| ---------- | ------------------- |
| uuid
| string |
registerPhoneAccount(...)
registerPhoneAccount(options: IOptions) => void
| Param | Type |
| ------------- | --------------------------------------------- |
| options
| IOptions |
registerAndroidEvents()
registerAndroidEvents() => void
unregisterAndroidEvents()
unregisterAndroidEvents() => void
displayIncomingCall(...)
displayIncomingCall(uuid: string, handle: string, localizedCallerName?: string | undefined, handleType?: HandleType | undefined, hasVideo?: boolean | undefined, options?: object | undefined) => void
| Param | Type |
| ------------------------- | ------------------------------------------------- |
| uuid
| string |
| handle
| string |
| localizedCallerName
| string |
| handleType
| HandleType |
| hasVideo
| boolean |
| options
| object |
startCall(...)
startCall(uuid: string, handle: string, contactIdentifier?: string | undefined, handleType?: HandleType | undefined, hasVideo?: boolean | undefined) => void
| Param | Type |
| ----------------------- | ------------------------------------------------- |
| uuid
| string |
| handle
| string |
| contactIdentifier
| string |
| handleType
| HandleType |
| hasVideo
| boolean |
updateDisplay(...)
updateDisplay(uuid: string, displayName: string, handle: string, options?: object | undefined) => void
| Param | Type |
| ----------------- | ------------------- |
| uuid
| string |
| displayName
| string |
| handle
| string |
| options
| object |
checkPhoneAccountEnabled()
checkPhoneAccountEnabled() => Promise<boolean>
Returns: Promise<boolean>
isConnectionServiceAvailable()
isConnectionServiceAvailable() => Promise<boolean>
Returns: Promise<boolean>
reportConnectedOutgoingCallWithUUID(...)
reportConnectedOutgoingCallWithUUID(uuid: string) => void
| Param | Type |
| ---------- | ------------------- |
| uuid
| string |
reportConnectingOutgoingCallWithUUID(...)
reportConnectingOutgoingCallWithUUID(uuid: string) => void
| Param | Type |
| ---------- | ------------------- |
| uuid
| string |
reportEndCallWithUUID(...)
reportEndCallWithUUID(uuid: string, reason: number) => void
| Param | Type |
| ------------ | ------------------- |
| uuid
| string |
| reason
| number |
rejectCall(...)
rejectCall(uuid: string) => void
| Param | Type |
| ---------- | ------------------- |
| uuid
| string |
endCall(...)
endCall(uuid: string) => void
| Param | Type |
| ---------- | ------------------- |
| uuid
| string |
endAllCalls()
endAllCalls() => void
setReachable()
setReachable() => void
setSettings(...)
setSettings(settings: IOptions) => void
| Param | Type |
| -------------- | --------------------------------------------- |
| settings
| IOptions |
isCallActive(...)
isCallActive(uuid: string) => Promise<boolean>
| Param | Type |
| ---------- | ------------------- |
| uuid
| string |
Returns: Promise<boolean>
getCalls()
getCalls() => Promise<{ callUUID: string; hasConnected: boolean; hasEnded: boolean; onHold: boolean; outgoing: boolean; }[] | void>
Returns: Promise<void | { callUUID: string; hasConnected: boolean; hasEnded: boolean; onHold: boolean; outgoing: boolean; }[]>
getAudioRoutes()
getAudioRoutes() => Promise<void>
supportConnectionService()
supportConnectionService() => boolean
Returns: boolean
hasPhoneAccount()
hasPhoneAccount() => Promise<boolean>
Returns: Promise<boolean>
hasOutgoingCall()
hasOutgoingCall() => Promise<boolean>
Returns: Promise<boolean>
setMutedCall(...)
setMutedCall(uuid: string, muted: boolean) => void
| Param | Type |
| ----------- | -------------------- |
| uuid
| string |
| muted
| boolean |
toggleAudioRouteSpeaker(...)
toggleAudioRouteSpeaker(uuid: string, routeSpeaker: boolean) => void
| Param | Type |
| ------------------ | -------------------- |
| uuid
| string |
| routeSpeaker
| boolean |
setOnHold(...)
setOnHold(uuid: string, held: boolean) => void
| Param | Type |
| ---------- | -------------------- |
| uuid
| string |
| held
| boolean |
setConnectionState(...)
setConnectionState(uuid: string, state: number) => void
| Param | Type |
| ----------- | ------------------- |
| uuid
| string |
| state
| number |
sendDTMF(...)
sendDTMF(uuid: string, key: string) => void
| Param | Type |
| ---------- | ------------------- |
| uuid
| string |
| key
| string |
checkIfBusy()
checkIfBusy() => Promise<boolean>
Returns: Promise<boolean>
checkSpeaker()
checkSpeaker() => Promise<boolean>
Returns: Promise<boolean>
setAvailable(...)
setAvailable(active: boolean) => void
| Param | Type |
| ------------ | -------------------- |
| active
| boolean |
setForegroundServiceSettings(...)
setForegroundServiceSettings(settings: NonNullable<IOptions['android']['foregroundService']>) => void
| Param | Type |
| -------------- | -------------------------------------------------------------------------------------------------------------- |
| settings
| { channelId: string; channelName: string; notificationTitle: string; notificationIcon?: string; } |
canMakeMultipleCalls(...)
canMakeMultipleCalls(allow: boolean) => void
| Param | Type |
| ----------- | -------------------- |
| allow
| boolean |
setCurrentCallActive(...)
setCurrentCallActive(callUUID: string) => void
| Param | Type |
| -------------- | ------------------- |
| callUUID
| string |
backToForeground()
backToForeground() => void
checkIsInManagedCall()
checkIsInManagedCall() => Promise<boolean>
Returns: Promise<boolean>
Interfaces
EventListener
| Method | Signature | | ---------- | ------------- | | remove | () => void |
IOptions
| Prop | Type |
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ios
| { appName: string; imageName?: string; supportsVideo?: boolean; maximumCallGroups?: string; maximumCallsPerCallGroup?: string; ringtoneSound?: string; includesCallsInRecents?: boolean; audioSession?: { categoryOptions?: number; mode?: string; }; } |
| android
| { alertTitle: string; alertDescription: string; cancelButton: string; okButton: string; imageName?: string; additionalPermissions: string[]; selfManaged?: boolean; foregroundService?: { channelId: string; channelName: string; notificationTitle: string; notificationIcon?: string; }; } |
Type Aliases
InitialEvents
{ [Event in Events]: { name: NativeEvents[Event], data: EventsPayload[Event] } }[Events][]
Events
keyof NativeEvents
NativeEvents
{ didReceiveStartCallAction: 'RNCallKeepDidReceiveStartCallAction'; answerCall: 'RNCallKeepPerformAnswerCallAction'; endCall: 'RNCallKeepPerformEndCallAction'; didActivateAudioSession: 'RNCallKeepDidActivateAudioSession'; didDeactivateAudioSession: 'RNCallKeepDidDeactivateAudioSession'; didDisplayIncomingCall: 'RNCallKeepDidDisplayIncomingCall'; didPerformSetMutedCallAction: 'RNCallKeepDidPerformSetMutedCallAction'; didToggleHoldCallAction: 'RNCallKeepDidToggleHoldAction'; didChangeAudioRoute: 'RNCallKeepDidChangeAudioRoute'; didPerformDTMFAction: 'RNCallKeepDidPerformDTMFAction'; showIncomingCallUi: 'RNCallKeepShowIncomingCallUi'; silenceIncomingCall: 'RNCallKeepOnSilenceIncomingCall'; createIncomingConnectionFailed: 'RNCallKeepOnIncomingConnectionFailed'; checkReachability: 'RNCallKeepCheckReachability'; didResetProvider: 'RNCallKeepProviderReset'; didLoadWithEvents: 'RNCallKeepDidLoadWithEvents'; onHasActiveCall : 'onHasActiveCall'; }
EventsPayload
{ didReceiveStartCallAction: { handle: string, callUUID?: string, name?: string }; answerCall: { callUUID: string }; endCall: { callUUID: string }; didActivateAudioSession: undefined; didDeactivateAudioSession: undefined; didDisplayIncomingCall: { error?: string, errorCode?: 'Unentitled' | 'CallUUIDAlreadyExists' | 'FilteredByDoNotDisturb' | 'FilteredByBlockList' | 'Unknown', callUUID: string, handle: string, localizedCallerName: string, hasVideo: '1' | '0', fromPushKit: '1' | '0', payload: object, }; didPerformSetMutedCallAction: { muted: boolean, callUUID: string }; didToggleHoldCallAction: { hold: boolean, callUUID: string }; didChangeAudioRoute: { output: string, reason?: number, handle?: string, callUUID?: string, }; didPerformDTMFAction: { digits: string, callUUID: string }; showIncomingCallUi: { handle: string, callUUID: string, name: string }; silenceIncomingCall: { handle: string, callUUID: string, name: string }; createIncomingConnectionFailed: { handle: string, callUUID: string, name: string }; checkReachability: undefined; didResetProvider: undefined; didLoadWithEvents: InitialEvents; onHasActiveCall : undefined; }
HandleType
'generic' | 'number' | 'email'
NonNullable
Exclude null and undefined from T
T extends null ? never : T
Enums
AudioSessionCategoryOption
| Members | Value |
| ------------------------------------------ | ----------------- |
| mixWithOthers
| 0x1 |
| duckOthers
| 0x2 |
| interruptSpokenAudioAndMixWithOthers
| 0x11 |
| allowBluetooth
| 0x4 |
| allowBluetoothA2DP
| 0x20 |
| allowAirPlay
| 0x40 |
| defaultToSpeaker
| 0x8 |
| overrideMutedMicrophoneInterruption
| 0x80 |
AudioSessionMode
| Members | Value |
| -------------------- | ----------------------------------------------- |
| default
| 'AVAudioSessionModeDefault' |
| gameChat
| 'AVAudioSessionModeGameChat' |
| measurement
| 'AVAudioSessionModeMeasurement' |
| moviePlayback
| 'AVAudioSessionModeMoviePlayback' |
| spokenAudio
| 'AVAudioSessionModeSpokenAudio' |
| videoChat
| 'AVAudioSessionModeVideoChat' |
| videoRecording
| 'AVAudioSessionModeVideoRecording' |
| voiceChat
| 'AVAudioSessionModeVoiceChat' |
| voicePrompt
| 'AVAudioSessionModeVoicePrompt' |