Getting Started
-
Install the plugin
Terminal window npm i @capgo/capacitor-simTerminal window pnpm add @capgo/capacitor-simTerminal window yarn add @capgo/capacitor-simTerminal window bun add @capgo/capacitor-sim -
Sync platforms
Terminal window npx cap syncTerminal window pnpm cap syncTerminal window yarn cap syncTerminal window bunx cap sync
Permissions
- Android: Ensure
android.permission.READ_PHONE_STATE(and on Android 13+,READ_BASIC_PHONE_STATE) is granted. Capacitor includes the manifest declarations, but you must request the permission before callinggetSimCards. - iOS: Carrier information is available automatically; the platform does not prompt for additional permissions. Be mindful of the limited data returned on iOS 16.4+ due to OS restrictions.
Request runtime access (Android)
import { Sim } from '@capgo/capacitor-sim';
const status = await Sim.checkPermissions();if (status.readSimCard !== 'granted') { const updated = await Sim.requestPermissions(); if (updated.readSimCard !== 'granted') { throw new Error('Telephony permission denied'); }}Read SIM cards
const { simCards } = await Sim.getSimCards();
simCards.forEach((card, index) => { console.log(`Slot ${card.simSlotIndex ?? index}:`, { carrier: card.carrierName, mcc: card.mobileCountryCode, mnc: card.mobileNetworkCode, country: card.isoCountryCode, subscriptionId: card.subscriptionId, });});Platform considerations
- Dual SIM devices: Iterate through the returned array; each entry corresponds to a slot. When present,
subscriptionIdhelps you interact with Androidβs telephony APIs. - iOS 16.4+: Apple redacts several carrier attributes. Expect placeholder values (
--,65535) and plan fallbacks in your UI. - Web: The plugin resolves with empty data because browsers cannot access SIM information.