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.
설치
설치란Capgo의 AI-Assisted Setup을 사용하여 플러그인을 설치할 수 있습니다. AI 도구에 Capgo 스킬을 추가하려면 다음 명령어를 사용하세요.
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins그런 다음 다음 명령어를 사용하세요:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-sim` plugin in my project.만약 Manual Setup을 선호한다면, 다음 명령어를 실행하고 아래의 플랫폼별 지침을 따르세요:
bun add @capgo/capacitor-simbunx cap syncimport { Sim } from '@capgo/capacitor-sim';API 개요
제목이 'API 개요'인 섹션getSimCards
제목이 'getSimCards'인 섹션SIM 카드 정보를 가져옵니다.
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에서는 항상 허용되며, Web에서는 항상 거부됩니다.
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
SIM 카드 정보 접근 권한을 요청합니다.SIM 카드 데이터를 읽기 위한 사용자에게 권한을 요청합니다. Android에서는 READ_PHONE_STATE 권한을 요청합니다. iOS에서는 항상 허용되며, Web에서는 권한이 거부됩니다.
클립보드에 복사
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();}SIM 카드 정보
타입 참조 섹션GetSimCardsResult
SIM 카드 정보 섹션.에서 반환되는 결과
export interface GetSimCardsResult { simCards: SimCard[];}PermissionStatus
권한 상태 섹션권한 확인 또는 요청 결과
export interface PermissionStatus { readSimCard: PermissionState;}SimCard
SIM 카드 설명 섹션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;}진실의 근원 섹션
클립보드 복사이 페이지는 플러그인의 src/definitions.ts. 업스트림에서 API이 변경되었을 때 다시 싱크를 실행하세요.
Getting Started에서 계속하세요.
Getting Started에서 계속하세요__CAPGO_KEEP_2__을 사용하는 경우 Getting Started __CAPGO_KEEP_2__와 API 연산을 계획하고 API을 연결하세요. Using @capgo/capacitor-sim Using @capgo/capacitor-sim에서 native capability을 사용하세요. API Overview API Overview에서 구현 세부 정보를 확인하세요. __CAPGO_KEEP_2__ 소개 소개에서 구현 세부 정보에 대해 API 키 소개에서 API 키에 대한 구현 세부 정보, 및 장치 장치에서 구현 세부 정보에 대해