6.0.0 • Published 1 year ago
capacitor-call-phone-number v6.0.0
capacitor-call-phone-number
A Simple Phone Call Plugin for Capacitor 6.
Plugin versions
Capacitor version | Plugin version |
---|---|
v6 | >= v6.0.0 |
Install
npm install capacitor-call-phone-number
npx cap sync
Android
This API requires the following permissions be added to your AndroidManifest.xml:
<uses-permission android:name="android.permission.CALL_PHONE" />
<queries>
<intent>
<action android:name="android.intent.action.DIAL" />
</intent>
</queries>
Example
import { CallPhoneNumber } from 'capacitor-call-phone-number';
const callPhone = async () => {
CallPhoneNumber.call({ phoneNumber: '15555555555' })
.then(result => {
console.log('callPhone:result', result);
})
.catch(err => {
console.log('callPhone:error', err);
});
};
const dialPhone = async () => {
CallPhoneNumber.call({ phoneNumber: '15555555555', type: 'dial' })
.then(result => {
console.log('dialPhone:result', result);
})
.catch(err => {
console.log('dialPhone:error', err);
});
API
call(...)
call(options: CallPhoneOptions) => Promise<CallPhoneResult>
Param | Type |
---|---|
options | CallPhoneOptions |
Returns: Promise<CallPhoneResult>
checkPermissions()
checkPermissions() => Promise<PermissionStatus>
Returns: Promise<PermissionStatus>
requestPermissions(...)
requestPermissions(permissions?: CallPhoneNumberPluginPermissions | undefined) => Promise<PermissionStatus>
Param | Type |
---|---|
permissions | CallPhoneNumberPluginPermissions |
Returns: Promise<PermissionStatus>
Interfaces
CallPhoneResult
Prop | Type |
---|---|
success | boolean |
CallPhoneOptions
Prop | Type | Description |
---|---|---|
phoneNumber | string | The phone number to be called |
type | 'call' | 'dial' | The type of call, optional, can be either 'call' or 'dial'. Only supports Android |
PermissionStatus
Prop | Type | Description |
---|---|---|
callPhone | PermissionState | Permission state for callPhone alias. |
CallPhoneNumberPluginPermissions
Prop | Type |
---|---|
permissions | 'callPhone'[] |
Type Aliases
PermissionState
'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'
CallPhoneNumberPermissionType
'callPhone'