내용으로 건너뛰기

시작하기

GitHub

설치

설치

플러그인을 설치하기 위해 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-android-sms-retriever` plugin in my project.

만약 Manual Setup을 선호한다면, 플러그인을 설치하기 위해 다음 명령어를 실행하고 아래의 플랫폼별 지침을 따르세요:

터미널 창
bun add @capgo/capacitor-android-sms-retriever
bunx cap sync android

수입

수입
import { AndroidSmsRetriever } from '@capgo/capacitor-android-sms-retriever';

안드로이드 요구 사항

안드로이드 요구 사항

SMS Retriever는 안드로이드 기기의 Google Play 서비스가 필요합니다. 플러그인은 앱을 배포하는 서명 키에 대한 해시를 반환하는 앱의 해시가 포함된 인증 SMS가 필요합니다. 서명 키에 대한 해시를 생성합니다. 디버그, 릴리스 및 Play App Signing 빌드는 다른 해시를 가질 수 있습니다. READ_SMS 또는 RECEIVE_SMS 권한.

인증 SMS에 포함된 앱 해시를 생성하여 앱을 배포하는 서명 키에 대한 해시를 생성합니다. 디버그, 릴리스 및 Play App Signing 빌드는 다른 해시를 가질 수 있습니다. getHashString(). Generate the hash for the signing key used to distribute the app. Debug, release, and Play App Signing builds can have different hashes.

인증 SMS를 기다리세요

인증 SMS를 기다리는 방법
import { AndroidSmsRetriever } from '@capgo/capacitor-android-sms-retriever';
const received = await AndroidSmsRetriever.addListener('smsReceived', ({ message }) => {
const code = message.match(/\b\d{6}\b/)?.[0];
console.log('Verification code:', code);
});
const timeout = await AndroidSmsRetriever.addListener('smsRetrieverTimeout', () => {
console.log('SMS Retriever timed out');
});
const errors = await AndroidSmsRetriever.addListener('smsRetrieverError', ({ message }) => {
console.error('SMS Retriever error:', message);
});
await AndroidSmsRetriever.startWatch();
// Remove listeners when the verification flow is done.
await received.remove();
await timeout.remove();
await errors.remove();
await AndroidSmsRetriever.stopWatch();
const { hash } = await AndroidSmsRetriever.getHashString();
console.log(hash);

인증 SMS에 이 해시를 백엔드에서 보낸 인증 SMS의 끝에 붙여넣으세요.

const { phoneNumber } = await AndroidSmsRetriever.getPhoneNumber();
console.log(phoneNumber);

사용자가 선택한 전화번호를 반환하는 native Phone Number Hint UI를 보여주고 있습니다.

예제 SMS

예제 SMS
<#> 123456 is your verification code.
FA+9qCX9VSu

Getting Started

Getting Started

Getting Started

Getting Started Getting Started Getting Started Using @capgo/capacitor-android-sms-retriever native 기능을 사용하는 @capgo/capacitor-android-sms-retriever에 대해 Capgo 플러그인 디렉토리 Capgo 플러그인 디렉토리에서 제품 워크플로우에 대해 Capacitor 플러그인들, Capgo Capacitor 플러그인들, Capgo의 구현 세부사항에 대해 플러그인을 추가하거나 업데이트 플러그인을 추가하거나 업데이트하는 구현 세부사항, 그리고 아이오닉 엔터프라이즈 플러그인 대체 아이오닉 엔터프라이즈 플러그인 대체의 제품 워크플로우에 대해