시작하기
설치 단계와 이 플러그인의 전체 마크다운 가이드가 포함된 설정 명령어를 복사하세요.
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.
설치
설치bun add @capgo/capacitor-admobbunx cap syncImport
Import 섹션import { AdMob } from '@capgo/capacitor-admob';API 개요
API 개요 섹션start
시작 섹션SDK AdMob 초기화 및 시작
import { AdMob } from '@capgo/capacitor-admob';
await AdMob.start();configure
설정 섹션AdMob 설정을 구성합니다.
import { AdMob } from '@capgo/capacitor-admob';
await AdMob.configure({ appMuted: false, appVolume: 0.5});configRequest
__CAPGO_KEEP_1__ configRequest 설정__CAPGO_KEEP_2__ 광고 요청 설정.
import { AdMob } from '@capgo/capacitor-admob';
await AdMob.configRequest({ maxAdContentRating: MaxAdContentRating.PG, tagForChildDirectedTreatment: true, testDeviceIds: ['test-device-id']});adCreate
__CAPGO_KEEP_1__ adCreate 설정__CAPGO_KEEP_2__ 새로운 광고 인스턴스 만들기.
import { AdMob } from '@capgo/capacitor-admob';
await AdMob.adCreate({ adUnitId: 'ca-app-pub-3940256099942544/1033173712'});adIsLoaded
__CAPGO_KEEP_1__ adIsLoaded 설정__CAPGO_KEEP_2__ 광고가 로드되었는지 확인.
import { AdMob } from '@capgo/capacitor-admob';
const isLoaded = await AdMob.adIsLoaded({ id: 1 });if (isLoaded) { await AdMob.adShow({ id: 1 });}__CAPGO_KEEP_2__ 광고 로드.
import { AdMob } from '@capgo/capacitor-admob';
await AdMob.adLoad({ id: 1 });adShow
__CAPGO_KEEP_1____CAPGO_KEEP_2__
import { AdMob } from '@capgo/capacitor-admob';
await AdMob.adShow({ id: 1 });adHide
__CAPGO_KEEP_1____CAPGO_KEEP_3__
import { AdMob } from '@capgo/capacitor-admob';
await AdMob.adHide({ id: 1 });trackingAuthorizationStatus
__CAPGO_KEEP_4____CAPGO_KEEP_0__
import { AdMob } from '@capgo/capacitor-admob';
const { status } = await AdMob.trackingAuthorizationStatus();if (status === TrackingAuthorizationStatus.notDetermined) { await AdMob.requestTrackingAuthorization();}requestTrackingAuthorization
__CAPGO_KEEP_0____CAPGO_KEEP_6__
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
요청 구성 섹션광고 요청 구성
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
모바일 광고 옵션 섹션모바일 광고의 기본 옵션입니다.
export type MobileAdOptions = { /** The ad unit ID from AdMob */ adUnitId: string;};TrackingAuthorizationStatus
TrackingAuthorizationStatusiOS 앱 추적성 투명성에 대한 권한 상태 추적
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광고 콘텐츠 등급을 제한하기 위해 사용되는 최대 광고 콘텐츠 등급 열거형
export enum MaxAdContentRating { /** General Audiences */ G = 'G', /** Mature Audiences */ MA = 'MA', /** Parental Guidance */ PG = 'PG', /** Teen */ T = 'T', /** Unspecified rating */ UNSPECIFIED = '',}Source Of Truth
이 페이지는 플러그인의업스트림에서 pubic __CAPGO_KEEP_0__이 변경될 때 다시 싱크를 실행하세요. src/definitions.ts. Re-run the sync when the public API changes upstream.