내용으로 건너뛰기

Getting Started

설치

설치
터미널 창
bun add @capgo/capacitor-sim
bunx cap sync
import { Sim } from '@capgo/capacitor-sim';

Copy to clipboard

Section titled “checkPermissions”

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

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

requestPermissions

SIM 카드 정보 접근 권한을 요청합니다.

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

타입 참조

타입 참조

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. upstream에서 pubic API이 변경되면 다시 싱크를 실행하세요.

Getting Started에서 계속

Getting Started에서 계속

Capgo를 사용 중이라면 Getting Started 대시보드와 API 연산을 계획하고 연결하려면 Using @capgo/capacitor-sim for the native capability in Using @capgo/capacitor-sim, Capacitor를 사용하여 Native 기능을 API-sim API 개요 Capacitor를 사용하여 Native 기능을 __CAPGO_KEEP_0__-sim Capacitor를 사용하여 Native 기능을 __CAPGO_KEEP_0__-sim API Keys Capacitor를 사용하여 Native 기능을 API-sim Capacitor를 사용하여 Native 기능을 __CAPGO_KEEP_0__-sim __CAPGO_KEEP_0__ 구현 세부 사항입니다.