Skip to main content

cordova-plugin-sim Alternative for Capacitor

cordova-plugin-sim alternative for Capacitor: read carrier, MCC, MNC and dual-SIM data with @capgo/capacitor-sim and Capacitor permission helpers.

Illustration of migrating a Cordova app to Capacitor, used for a SIM card information plugin guide

The practical cordova-plugin-sim alternative for a Capacitor app is @capgo/capacitor-sim. It replaces window.plugins.sim.getSimInfo callbacks with Sim.getSimCards(), returns one SimCard per subscription on dual-SIM Android phones, and uses Capacitor permission APIs instead of Cordova-only permission shims. This guide lists npm facts, install steps, usage, field mapping, and migration examples.

Why leave cordova-plugin-sim in Capacitor

cordova-plugin-sim on npm is version 1.3.3. The last numbered release on the npm time object is 4 January 2017. The registry modified timestamp is 7 November 2023 (metadata only, not a new plugin version). The npm repository URL points to pbakondy/cordova-plugin-sim.

The JavaScript bridge in www/sim.js exposes:

  • getSimInfo(success, error) returning one object with carrierName, countryCode, mcc, and mnc
  • On Android, hasReadPermission and requestReadPermission live in www/android/sim.js

Extra Android fields such as phone number and a cards array require READ_PHONE_STATE and are documented in the upstream README, but the core Cordova API is still callback based.

@capgo/capacitor-sim latest on npm is 8.0.55 with a modified date of 13 November 2026. src/definitions.ts documents getSimCards, checkPermissions, requestPermissions, and optional Android-only number, subscriptionId, and simSlotIndex. Capgo ships fixes on an open source cadence where a human still reviews, tests and merges 50+ pull requests daily.

Install

The command below installs the npm 8.x line for Capacitor 8 (@capacitor/core >= 8). Capgo plugin majors track Capacitor majors. On Capacitor 7, install the matching 7.x release instead (see the plugin README).

bun add @capgo/capacitor-sim
bunx cap sync

On Android 6+, declare READ_PHONE_STATE in the manifest. The native bridge reports readPhoneState and readPhoneNumbers from checkPermissions() / requestPermissions(); iOS returns readSimCard. getSimCards() also requests missing Android permissions when you call it directly. Carrier fields can be placeholders on iOS 16.4+ (see Capgo definitions.ts and upstream iOS discussion).

Usage example

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

type SimPermissionStatus = Awaited<ReturnType<typeof Sim.checkPermissions>> & {
  readPhoneState?: 'granted' | 'denied' | 'prompt';
  readPhoneNumbers?: 'granted' | 'denied' | 'prompt';
};

function hasSimReadAccess(status: SimPermissionStatus): boolean {
  if (Capacitor.getPlatform() === 'android') {
    return status.readPhoneState === 'granted';
  }
  return status.readSimCard === 'granted';
}

export async function logCarrierInfo() {
  let status = await Sim.checkPermissions();
  if (!hasSimReadAccess(status)) {
    status = await Sim.requestPermissions();
    if (!hasSimReadAccess(status)) return;
  }

  try {
    const { simCards } = await Sim.getSimCards();
    for (const sim of simCards) {
      console.log(sim.carrierName, sim.isoCountryCode, sim.mobileCountryCode, sim.mobileNetworkCode);
    }
  } catch (err) {
    console.error(err);
  }
}

On Android, @capgo/capacitor-sim 8.0.55 maps manifest aliases to readPhoneState and readPhoneNumbers in the permission result. Below Android 11 only readPhoneState is required; on API 30+ readPhoneNumbers can stay prompt until you call getSimCards(), which requests it. iOS returns readSimCard: 'granted' without a prompt. TypeScript still types PermissionStatus as { readSimCard }, so the helper above gates on readPhoneState on Android.

Migrating from Cordova to Capacitor

// Before (Cordova)
window.plugins.sim.getSimInfo(
  (info) => console.log(info.carrierName, info.mcc, info.mnc),
  (err) => console.error(err),
);
// After (Capacitor)
import { Sim } from '@capgo/capacitor-sim';

export async function logFirstSim() {
  const { simCards } = await Sim.getSimCards();
  if (simCards.length === 0) return;
  const first = simCards[0];
  console.log(first.carrierName, first.mobileCountryCode, first.mobileNetworkCode);
}

simCards[0] is the first entry in the array, not necessarily the default or primary SIM. Dual-SIM order is platform defined and the API exposes no primary flag.

// Before (Cordova Android permissions)
window.plugins.sim.requestReadPermission(success, error);
// After (Capacitor)
await Sim.requestPermissions();

API mapping table

cordova-plugin-sim (window.plugins.sim) @capgo/capacitor-sim
getSimInfo(success, error) getSimCards() returns { simCards: SimCard[] }
info.carrierName sim.carrierName
info.countryCode sim.isoCountryCode
info.mcc sim.mobileCountryCode
info.mnc sim.mobileNetworkCode
info.allowsVOIP (iOS, Cordova README) sim.allowsVOIP
Android hasReadPermission checkPermissions() returns { readPhoneState, readPhoneNumbers? } on Android; { readSimCard } on iOS
Android requestReadPermission requestPermissions() (same shape) or implicit prompt inside getSimCards()
Single SIM object simCards[0] (first returned, not labeled primary) or iterate all slots
info.cards[] (Android, READ_PHONE_STATE) { simCards } array
info.phoneNumber or cards[].phoneNumber (Android, README) sim.number
cards[].subscriptionId (Android, README) sim.subscriptionId
cards[].simSlotIndex (Android, README) sim.simSlotIndex
Not in Cordova getPluginVersion()
Cordova plugin install bun add @capgo/capacitor-sim plus bunx cap sync

SIM reads use platform telephony APIs in the native binary. Use Capgo Build for store builds, then ship permission UX tweaks with Capgo live updates where allowed. For the full platform move, read the Cordova to Capacitor migration guide.

Live updates for Capacitor apps

When a web-layer bug is live, ship the fix through Capgo instead of waiting days for app store approval. Users get the update in the background while native changes stay in the normal review path.

Latest from our Blog

Capgo gives you the best insights you need to create a truly professional mobile app.