시작하기
이 플러그인의 설치 단계와 전체 마크다운 가이드가 포함된 설정 프롬프트를 복사하세요.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-admob`
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/admob/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-admob` plugin in my project.수동 설정을 선호한다면, 다음 명령어를 실행하여 플러그인을 설치하고 아래의 플랫폼별 지침을 따르세요:
bun add @capgo/capacitor-admobnpx cap sync가져오기
“Import” 섹션import { AdMob } from '@capgo/capacitor-admob';빠른 시작
“빠른 시작” 섹션import { AdMob } from '@capgo/capacitor-admob';
await AdMob.start();예시: configure
“예시: configure” 섹션import { AdMob } from '@capgo/capacitor-admob';
await AdMob.configure({ appMuted: false, appVolume: 0.5});예시: configRequest
“예시: configRequest” 섹션import { AdMob, MaxAdContentRating } from '@capgo/capacitor-admob';
await AdMob.configRequest({ maxAdContentRating: MaxAdContentRating.PG, tagForChildDirectedTreatment: true, testDeviceIds: ['test-device-id']});자주 하는 실수
“흔한 실수” 섹션- 리스너: 화면이 언마운트될 때 핸들을 제거합니다.
- 한 번만 초기화: 앱 부트스트랩 시 setup을 실행하세요.
- 신뢰할 수 있는 소스: 신뢰
src/definitions.tsGitHub 레포지토리에서.
API 개요
“API 개요” 섹션start
“start” 섹션AdMob SDK를 초기화하고 시작합니다.
import { AdMob } from '@capgo/capacitor-admob';
await AdMob.start();configure
“configure” 섹션AdMob 설정을 구성합니다.
import { AdMob } from '@capgo/capacitor-admob';
await AdMob.configure({ appMuted: false, appVolume: 0.5});configRequest
“configRequest” 섹션광고 요청 설정을 구성합니다.
import { AdMob, MaxAdContentRating } from '@capgo/capacitor-admob';
await AdMob.configRequest({ maxAdContentRating: MaxAdContentRating.PG, tagForChildDirectedTreatment: true, testDeviceIds: ['test-device-id']});adCreate
“adCreate” 섹션새 광고 인스턴스를 생성합니다.
import { AdMob } from '@capgo/capacitor-admob';
await AdMob.adCreate({ adUnitId: 'ca-app-pub-3940256099942544/1033173712'});adIsLoaded
“adIsLoaded” 섹션광고가 로드되어 표시 가능한 상태인지 확인합니다.
import { AdMob } from '@capgo/capacitor-admob';
const isLoaded = await AdMob.adIsLoaded({ id: 1 });if (isLoaded) { await AdMob.adShow({ id: 1 });}adLoad
“adLoad” 섹션광고를 로드합니다.
import { AdMob } from '@capgo/capacitor-admob';
await AdMob.adLoad({ id: 1 });adShow
“adShow” 섹션로드된 광고를 표시합니다.
import { AdMob } from '@capgo/capacitor-admob';
await AdMob.adShow({ id: 1 });adHide
“adHide” 섹션현재 표시 중인 광고를 숨깁니다.
import { AdMob } from '@capgo/capacitor-admob';
await AdMob.adHide({ id: 1 });trackingAuthorizationStatus
“trackingAuthorizationStatus” 섹션현재 추적 권한 상태를 가져옵니다 (iOS 전용).
import { AdMob, TrackingAuthorizationStatus } from '@capgo/capacitor-admob';
const { status } = await AdMob.trackingAuthorizationStatus();if (status === TrackingAuthorizationStatus.notDetermined) { await AdMob.requestTrackingAuthorization();}requestTrackingAuthorization
“requestTrackingAuthorization” 섹션사용자에게 추적 권한을 요청합니다 (iOS 전용).
import { AdMob } from '@capgo/capacitor-admob';
const { status } = await AdMob.requestTrackingAuthorization();console.log('User tracking status:', status);타입 레퍼런스
“타입 참조” 섹션AdMobConfig
“AdMobConfig” 섹션AdMob 설정 옵션입니다.
export type AdMobConfig = { /** Whether the app should be muted */ appMuted?: boolean; /** The app volume (0.0 to 1.0) */ appVolume?: number;};RequestConfig
“RequestConfig” 섹션광고 요청 설정입니다.
export type RequestConfig = { /** Maximum ad content rating */ maxAdContentRating?: MaxAdContentRating; /** Whether to use the same app key */ sameAppKey?: boolean; /** Tag for child-directed treatment (true, false, or null for unspecified) */ tagForChildDirectedTreatment?: boolean | null; /** Tag for under age of consent (true, false, or null for unspecified) */ tagForUnderAgeOfConsent?: boolean | null; /** Array of test device IDs */ testDeviceIds?: string[];};MobileAdOptions
“MobileAdOptions” 섹션모바일 광고 기본 옵션.
export type MobileAdOptions = { /** The ad unit ID from AdMob */ adUnitId: string;};TrackingAuthorizationStatus
“TrackingAuthorizationStatus” 섹션iOS 앱 트래킹 투명성(ATT)의 트래킹 권한 상태.
export enum TrackingAuthorizationStatus { /** User has not yet received an authorization request */ notDetermined = 0, /** User restricted, device is unable to provide authorization */ restricted = 1, /** User denied authorization */ denied = 2, /** User authorized access */ authorized = 3,}MaxAdContentRating
“MaxAdContentRating” 섹션콘텐츠 등급에 따라 광고를 제한하는 데 사용되는 최대 광고 콘텐츠 등급 enum.
export enum MaxAdContentRating { /** General Audiences */ G = 'G', /** Mature Audiences */ MA = 'MA', /** Parental Guidance */ PG = 'PG', /** Teen */ T = 'T', /** Unspecified rating */ UNSPECIFIED = '',}Source of Truth
“Source Of Truth” 섹션이 페이지는 플러그인의 src/definitions.tsupstream에서 public API가 변경되면 sync를 다시 실행하세요.
시작하기 다음 단계
“Getting Started에서 계속하기” 섹션사용 중이라면 시작하기 대시보드 및 API 운영을 계획하려면, 이를 다음과 연결하세요 @capgo/capacitor-admob 사용하기 @capgo/capacitor-admob를 사용하여 네이티브 기능을 구현할 때, API 개요 구현 세부 사항은 API 개요에서 소개 구현 세부 사항은 소개에서 API 키 API Keys의 구현 세부 사항은, 기기 Devices의 구현 세부 사항은.