Skip to content

luisbytes/capacitor-telephony

Repository files navigation

@luisbytes/capacitor-telephony

TelephonyManager only for Android

Install

npm install @luisbytes/capacitor-telephony
npx cap sync

Android setup

To use this plugin you need to add the following permissions to the AndroidManifest.xml before or after the application tag.

<uses-permission android:name="android.permission.READ_BASIC_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" android:maxSdkVersion="32" />

API

getInfo()

getInfo() => Promise<TelephonyInfo>

Returns: Promise<TelephonyInfo>


getNetworkType(...)

getNetworkType(options?: { withBasicPermission?: boolean | undefined; } | undefined) => Promise<{ type: TelephonyNetworkType; }>
Param Type
options { withBasicPermission?: boolean; }

Returns: Promise<{ type: TelephonyNetworkType; }>


Interfaces

TelephonyInfo

Prop Type
dataState TelephonyDataState
signalStrengthLevel TelephonySignalStrengthLevel
simOperatorName string

Enums

TelephonyDataState

Members Value
UNKNOWN "UNKNOWN"
DISCONNECTED "DISCONNECTED"
CONNECTING "CONNECTING"
CONNECTED "CONNECTED"
SUSPENDED "SUSPENDED"
DISCONNECTING "DISCONNECTING"
HANDOVER_IN_PROGRESS "HANDOVER_IN_PROGRESS"

TelephonySignalStrengthLevel

Members Value
UNKNOWN "UNKNOWN"
NONE "NONE"
POOR "POOR"
MODERATE "MODERATE"
GOOD "GOOD"
GREAT "GREAT"

TelephonyNetworkType

Members Value
UNKNOWN "UNKNOWN"
TWO_G "2G"
THREE_G "3G"
LTE "LTE"
FIVE_G "5G"