Skip to main content
@capgo/capacitor-sim Device APIs Open source

SIM Capacitor plugin

Retrieve SIM card information including carrier name, country code, and phone number

Install

bun add @capgo/capacitor-sim bunx cap sync
npm, pnpm or yarn
  • npm install @capgo/capacitor-sim
  • pnpm add @capgo/capacitor-sim
  • yarn add @capgo/capacitor-sim

Guide

How to use SIM in Capacitor

Test on device

Download the Capgo app, then scan the QR code.

SIM plugin preview QR code

Using @capgo/capacitor-sim

Capacitor SIM Plugin for retrieving information from device SIM cards.

Install

bun add @capgo/capacitor-sim
bunx cap sync

bunx cap sync copies the plugin's native code into your native projects. Run it again after every plugin upgrade.

Import

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

API at a glance

Method Description
getSimCards Get information from the device's SIM cards.
checkPermissions Check permission to access SIM card information.
requestPermissions Request permission to access SIM card information.

Examples

getSimCards()

Get information from the device's SIM cards.

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

const { simCards } = await Sim.getSimCards();
simCards.forEach((sim, index) => {
  console.log(`SIM ${index + 1}:`);
  console.log(`  Carrier: ${sim.carrierName}`);
  console.log(`  Country: ${sim.isoCountryCode}`);
  console.log(`  MCC: ${sim.mobileCountryCode}`);
  console.log(`  MNC: ${sim.mobileNetworkCode}`);
});

checkPermissions()

Check permission to access SIM card information.

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

const status = await Sim.checkPermissions();
if (status.readSimCard === 'granted') {
  console.log('Permission granted');
} else {
  console.log('Permission not granted');
}

requestPermissions()

Request permission to access SIM card information.

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

const status = await Sim.requestPermissions();
if (status.readSimCard === 'granted') {
  // Now you can call getSimCards()
  const simCards = await Sim.getSimCards();
}

Full reference

Keep going from Using @capgo/capacitor-sim

If you are using Using @capgo/capacitor-sim to plan dashboard and API operations, connect it with @capgo/capacitor-sim for the implementation detail in @capgo/capacitor-sim, Getting Started for the implementation detail in Getting Started, API Overview for the implementation detail in API Overview, Introduction for the implementation detail in Introduction, and API Keys for the implementation detail in API Keys.

FAQ

SIM plugin FAQ

How do I install the SIM plugin in a Capacitor app?

Run "bun add @capgo/capacitor-sim" (or "npm install @capgo/capacitor-sim"), then run "bunx cap sync" so the iOS and Android projects pick up the native code. Import it from "@capgo/capacitor-sim" in your app code.

Does @capgo/capacitor-sim work with React, Vue and Angular?

Yes. SIM is a Capacitor package, so it works with any web framework that runs inside Capacitor, including Ionic, React, Vue, Angular, Svelte and plain JavaScript.

Which Capacitor version does @capgo/capacitor-sim support?

Capgo plugins follow Capacitor's major version: use the plugin major version that matches your Capacitor major version (for example plugin v8 with Capacitor 8). The compatibility table in the GitHub README lists the maintained versions.

Is @capgo/capacitor-sim free and open source?

Yes. The source code is public on GitHub at https://github.com/Cap-go/capacitor-sim/ and the package is free to install from npm. Bug reports and pull requests are welcome.

Can I update code that uses SIM without an App Store review?

Installing or upgrading the plugin changes native code, so it needs a new store build. After that, JavaScript, HTML and CSS changes that call the plugin can ship instantly with Capgo live updates.

Ship SIM changes without waiting for app review

Once the plugin is in your store build, Capgo live updates push your JavaScript, HTML and CSS changes to users in minutes.

Start with Capgo