6.0.0 • Published 1 year ago

capacitor-call-phone-number v6.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

capacitor-call-phone-number

A Simple Phone Call Plugin for Capacitor 6.

Plugin versions

Capacitor versionPlugin 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>
ParamType
optionsCallPhoneOptions

Returns: Promise<CallPhoneResult>


checkPermissions()

checkPermissions() => Promise<PermissionStatus>

Returns: Promise<PermissionStatus>


requestPermissions(...)

requestPermissions(permissions?: CallPhoneNumberPluginPermissions | undefined) => Promise<PermissionStatus>
ParamType
permissionsCallPhoneNumberPluginPermissions

Returns: Promise<PermissionStatus>


Interfaces

CallPhoneResult

PropType
successboolean

CallPhoneOptions

PropTypeDescription
phoneNumberstringThe phone number to be called
type'call' | 'dial'The type of call, optional, can be either 'call' or 'dial'. Only supports Android

PermissionStatus

PropTypeDescription
callPhonePermissionStatePermission state for callPhone alias.

CallPhoneNumberPluginPermissions

PropType
permissions'callPhone'[]

Type Aliases

PermissionState

'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'

CallPhoneNumberPermissionType

'callPhone'

6.0.0

1 year ago

4.0.0

1 year ago