컨텐츠로 바로가기

Getting Started

GitHub

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-sim
bunx cap sync
import { Sim } from '@capgo/capacitor-sim';

__CAPGO_KEEP_0__

__CAPGO_KEEP_0__ __CAPGO_KEEP_0__ __CAPGO_KEEP_1__ __CAPGO_KEEP_0__

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

__CAPGO_KEEP_3__

__CAPGO_KEEP_4__

__CAPGO_KEEP_5__

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

__CAPGO_KEEP_7__

__CAPGO_KEEP_8__

__CAPGO_KEEP_9__

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();
}

__CAPGO_KEEP_11__

타입 참조 섹션

GetSimCardsResult

SIM 카드 정보 섹션

.에서 반환되는 결과

export interface GetSimCardsResult {
simCards: SimCard[];
}

PermissionStatus

권한 상태 섹션

권한 확인 또는 요청 결과

export interface PermissionStatus {
readSimCard: PermissionState;
}

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;
}

진실의 근원 섹션

protectedTokens

이 페이지는 플러그인의 src/definitions.ts. upstream에서 변경된 경우 pubic API을 다시 동기화하세요.

Getting Started에서 계속

Getting Started에서 계속하기

이 플러그인을 사용 중이라면 Getting Started 대시보드 및 API 연산을 계획하고 싶다면 Using @capgo/capacitor-sim Using @capgo/capacitor-sim에서 native capability을 사용하는 경우 API Overview API Overview에서 구현 세부 정보를 확인하세요. 소개 __CAPGO_KEEP_0__ API 키 API 키의 구현 세부 사항, 및 장치 __CAPGO_KEEP_0__ 키의 구현 세부 사항.