Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@jonz94/capacitor-sim

jonz941.9k0BSD3.0.2TypeScript support: included

Capacitor plugin to get information from device's sim cards

capacitor, plugin, native, sim

readme


Sim

@jonz94/capacitor-sim

Capacitor plugin to get information from device's sim cards.

Install

npm install @jonz94/capacitor-sim
npx cap sync

Android

Variables

This plugin will use the following project variables (defined in your app's variables.gradle file):

  • androidxCoreKTXVersion version of androidx.core:core-ktx (default: 1.10.0)
  • kotlin_version version of org.jetbrains.kotlin:kotlin-stdlib (default: 1.8.20)

Configuration

No configuration required for this plugin.

Demo

A working example can be found here: jonz94/capacitor-sim-demo

Usage

import { Sim } from '@jonz94/capacitor-sim';

const getSimCards = async () => {
  const { simCards } = await Sim.getSimCards();

  // console.log(simCards);

  return simCards;
}

API

<docgen-index> </docgen-index> <docgen-api>

getSimCards()

getSimCards() => Promise<GetSimCardsResult>

Get information from device's sim cards.

Returns: Promise<GetSimCardsResult>

Since: 1.0.0


checkPermissions()

checkPermissions() => Promise<PermissionStatus>

Check permission to get information from device's sim cards.

On iOS the status is always granted.

Returns: Promise<PermissionStatus>

Since: 1.0.0


requestPermissions()

requestPermissions() => Promise<PermissionStatus>

Request permission to get information from device's sim cards.

On iOS the status is always granted.

Returns: Promise<PermissionStatus>

Since: 1.0.0


Interfaces

GetSimCardsResult

Prop Type
simCards SimCard[]

SimCard

Prop Type Description Since
number string Android only: Phone number. 1.0.0
allowsVOIP boolean iOS only: If this carrier allows VOIP calls to be made on its network. 1.0.0
carrierName string The name of the cellular service provider. 1.0.0
isoCountryCode string Country code for the cellular service provider, represented as an ISO 3166-1 country code string. 1.0.0
mobileCountryCode string Mobile country code (MCC) for the cellular service provider, in its numeric representation. 1.0.0
mobileNetworkCode string Mobile network code (MNC) for the cellular service provider, in its numeric representation. 1.0.0

PermissionStatus

Prop Type
readSimCard PermissionState

Type Aliases

PermissionState

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

</docgen-api>

Changelog

See CHANGELOG.md.

License

See LICENSE.

changelog

Changelog

All notable changes to this project will be documented in this file.

3.0.2 (2025-01-22)

3.0.1 (2024-11-13)

Bug Fixes

  • update all development dependencies (d60cec4)

3.0.0 (2024-07-15)

⚠ BREAKING CHANGES

  • upgrade to Capacitor 6

Features

  • upgrade to Capacitor 6 (#11), closes #9

2.0.0 (2023-05-07)

⚠ BREAKING CHANGES

  • upgrade to Capacitor 5

Features

  • upgrade to Capacitor 5 (bb28f65)
  • android: add android 13 support (804f90e)
  • android: use java 17 (ad2a8f9)
  • android: update gradle to 8.0.2 and gradle plugin to 8.0.0 (5253c7e)
  • android: update gradle wrapper (6b3f928)

Bug Fixes

  • android: fix phone number is empty string on android 11 and above (66a8844)
  • android: resolve permission issue (cfe5a8b)
  • android: resolve permission issue for android 13 (d8939ff)
  • ios: fix "Empty collection literal requires an explicit type" warning (5ea57b3)

1.0.5 (2023-04-16)

Bug Fixes

  • android: fix phone number is empty string on android 11 and above (#6) (0f9a853), closes #3

1.0.4 (2023-02-27)

Bug Fixes

  • android: resolve crash issue on Android < 10 (4858507)

1.0.3 (2023-02-22)

Bug Fixes

  • add missing required attribute authors (#2) (70538b7), closes #1

1.0.2 (2022-11-11)

Bug Fixes

  • android: resolve issues that warning messages occur when building apk

1.0.1 (2022-10-20)

Bug Fixes

  • docs: improve documentation and comments

1.0.0 (2022-09-15)

Features

  • improve documentation and comments (446aaf2)