시작하기
이 플러그인의 설치 단계와 전체 마크다운 가이드를 포함한 설정 프롬프트를 복사하세요.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-android-sms-retriever`
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/android-sms-retriever/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.
설치
설치 제목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-retrieverbunx cap sync android수입
수입import { AndroidSmsRetriever } from '@capgo/capacitor-android-sms-retriever';안드로이드 요구 사항
안드로이드 요구 사항SMS Retriever는 안드로이드 기기의 Google Play 서비스가 필요합니다. 플러그인은 기기를 요청하지 않습니다. READ_SMS 또는 RECEIVE_SMS SMS Retriever는 Google Play 서비스가 필요합니다. 플러그인은 기기를 요청하지 않습니다.
인증 SMS는 플러그인이 반환한 앱 해시를 포함해야 합니다. 앱 해시는 배포하는 앱에 사용한 서명 키의 해시입니다. 디버그, 릴리스 및 Play App Signing 빌드는 다른 해시를 가질 수 있습니다. getHashString()권한.
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 인증 메시지의 끝에 사용하세요.
사용자 전화번호 힌트를 요청하세요.
사용자 전화번호 힌트를 요청하는 방법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 StartedGetting Started을 사용하여 native plugin 작업을 계획하고 있다면 Getting Started을 @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-android-sms-retriever와 연결하세요. __CAPGO_KEEP_0__ Using @capgo/capacitor-android-sms-retriever native 기능을 사용하는 @capgo/capacitor-android-sms-retriever에 대해 Capgo 플러그인 디렉토리 Capgo 플러그인에 대해 __CAPGO_KEEP_1__ Capacitor 플러그인에 대해 Capgo for the implementation detail in Capacitor Plugins by Capgo, 플러그인을 추가하거나 업데이트하는 방법에 대한 구현 세부 정보, 그리고 Ionic Enterprise 플러그인 대체 Ionic Enterprise 플러그인 대체에 대한 제품 워크플로우. 페이지 편집