Getting Started
설치 단계 및 이 플러그인의 전체 마크다운 가이드를 포함하는 설정 지시문을 복사하세요.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-sim`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/sim/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
설치
설치bun add @capgo/capacitor-simbunx cap syncImport
‘Import’라는 제목의 섹션import { Sim } from '@capgo/capacitor-sim';API 개요
API 개요라는 제목의 섹션getSimCards
‘getSimCards’라는 제목의 섹션장치의 SIM 카드에서 정보를 가져옵니다.
장치에 설치된 모든 SIM 카드에 대한 세부 정보를 반환합니다. 두 개의 SIM 카드가 있는 장치에서 정보를 반환합니다. Android에서 READ_PHONE_STATE 권한이 필요합니다.
import { Sim } from '@capgo/capacitor-sim';
const { simCards } = await SimPlugin.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
‘checkPermissions’라는 제목의 섹션SIM 카드 정보 접근 권한 확인
SIM 카드 데이터 읽기 권한이 있는지 확인합니다. Android에서는 READ_PHONE_STATE 권한을 확인합니다. iOS에서는 항상 허용됩니다. 웹에서는 항상 거부됩니다.
import { Sim } from '@capgo/capacitor-sim';
const status = await SimPlugin.checkPermissions();if (status.readSimCard === 'granted') { console.log('Permission granted');} else { console.log('Permission not granted');}requestPermissions
requestPermissionsSIM 카드 정보 접근 권한 요청
SIM 카드 데이터 읽기 권한을 부여하도록 사용자에게 요청합니다. Android에서는 READ_PHONE_STATE 권한을 요청합니다. iOS에서는 항상 허용됩니다. 웹에서는 항상 거부됩니다.
import { Sim } from '@capgo/capacitor-sim';
const status = await SimPlugin.requestPermissions();if (status.readSimCard === 'granted') { // Now you can call getSimCards() const simCards = await SimPlugin.getSimCards();}타입 참조
타입 참조GetSimCardsResult
SIM 카드 정보 가져오기 결과SIM 카드 정보 가져오기 메서드의 반환 결과입니다.
export interface GetSimCardsResult { simCards: SimCard[];}PermissionStatus
권한 상태권한 확인 또는 요청의 결과입니다.
export interface PermissionStatus { readSimCard: PermissionState;}SimCard
SIM 카드 설명클립보드에 복사
export interface SimCard { /** * Android only: Phone number for this SIM slot, when available. * * @since 1.0.0 */ number?: string;
/** * Android only: Unique subscription identifier. * * @since 1.1.0 */ subscriptionId?: string;
/** * Android only: Physical SIM slot index for this subscription. * * @since 1.1.0 */ simSlotIndex?: number;
/** * iOS only: Indicates whether the carrier supports VoIP. * * @since 1.0.0 */ allowsVOIP?: boolean;
/** * Display name of the cellular service provider. * * On iOS 16.4+ the system may return placeholder values such as `--`. * See https://github.com/jonz94/capacitor-sim/issues/8 for details. * * @since 1.0.0 */ carrierName: string;
/** * ISO 3166-1 alpha-2 country code of the service provider. * * On iOS 16.4+ the system may return an empty string or `--`. * See https://github.com/jonz94/capacitor-sim/issues/8 for details. * * @since 1.0.0 */ isoCountryCode: string;
/** * Mobile Country Code (MCC) of the service provider. * * On iOS 16.4+ the system may return placeholder values such as `65535`. * See https://github.com/jonz94/capacitor-sim/issues/8 for details. * * @since 1.0.0 */ mobileCountryCode: string;
/** * Mobile Network Code (MNC) of the service provider. * * On iOS 16.4+ the system may return placeholder values such as `65535`. * See https://github.com/jonz94/capacitor-sim/issues/8 for details. * * @since 1.0.0 */ mobileNetworkCode: string;}이 페이지는 플러그인의
업스트림에서 __CAPGO_KEEP_0__이 변경될 때마다 다시 싱크를 실행하세요.시작부터 계속 src/definitions.ts. Re-run the sync when the public API changes upstream.
권한 상태
SIM 카드 설명만약에 __CAPGO_KEEP_0__을 사용하고 있다면 Getting Started API과 연결하여 대시보드와 API 연산을 계획하세요 Using @capgo/capacitor-sim Using @capgo/capacitor-sim API 개요 API 구현 세부 사항 소개 __CAPGO_KEEP_0__ 구현 세부 사항 API 키 API 구현 세부 사항 장치 __CAPGO_KEEP_0__ 구현 세부 사항.