내용으로 건너뛰기

시작하기

GitHub

Capgo의 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.

복사

Manual Setup을 사용하는 경우, 다음 명령어를 실행하고 아래에 플랫폼에 따라 설명된 지침을 따르세요.
bun add @capgo/capacitor-admob
bunx cap sync
import { AdMob } from '@capgo/capacitor-admob';

API 개요

API 개요

SDK를 초기화하고 시작합니다.

import { AdMob } from '@capgo/capacitor-admob';
await AdMob.start();

__CAPGO_KEEP_0__ 설정

import { AdMob } from '@capgo/capacitor-admob';
await AdMob.configure({
appMuted: false,
appVolume: 0.5
});

__CAPGO_KEEP_0__ 설정을 구성합니다.

import { AdMob } from '@capgo/capacitor-admob';
await AdMob.configRequest({
maxAdContentRating: MaxAdContentRating.PG,
tagForChildDirectedTreatment: true,
testDeviceIds: ['test-device-id']
});

__CAPGO_KEEP_2__ 광고 인스턴스를 새로 생성합니다.

import { AdMob } from '@capgo/capacitor-admob';
await AdMob.adCreate({
adUnitId: 'ca-app-pub-3940256099942544/1033173712'
});

__CAPGO_KEEP_4__이 로드되었는지 확인합니다.

import { AdMob } from '@capgo/capacitor-admob';
const isLoaded = await AdMob.adIsLoaded({ id: 1 });
if (isLoaded) {
await AdMob.adShow({ id: 1 });
}

__CAPGO_KEEP_6__을 로드합니다.

import { AdMob } from '@capgo/capacitor-admob';
await AdMob.adLoad({ id: 1 });

__CAPGO_KEEP_0__을 로드된 광고를 표시합니다.

import { AdMob } from '@capgo/capacitor-admob';
await AdMob.adShow({ id: 1 });

__CAPGO_KEEP_0__ 현재 표시 중인 광고를 숨깁니다.

import { AdMob } from '@capgo/capacitor-admob';
await AdMob.adHide({ id: 1 });

trackingAuthorizationStatus

__CAPGO_KEEP_0__ 섹션

__CAPGO_KEEP_0__ (iOS만 지원합니다.)

import { AdMob } from '@capgo/capacitor-admob';
const { status } = await AdMob.trackingAuthorizationStatus();
if (status === TrackingAuthorizationStatus.notDetermined) {
await AdMob.requestTrackingAuthorization();
}

requestTrackingAuthorization

__CAPGO_KEEP_0__ 섹션

__CAPGO_KEEP_0__ (iOS만 지원합니다.)

import { AdMob } from '@capgo/capacitor-admob';
const { status } = await AdMob.requestTrackingAuthorization();
console.log('User tracking status:', status);

__CAPGO_KEEP_0__

타입 참조 섹션

광고 모바일 구성 옵션

export type AdMobConfig = {
/** Whether the app should be muted */
appMuted?: boolean;
/** The app volume (0.0 to 1.0) */
appVolume?: number;
};

광고 요청 구성

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[];
};

모바일 광고 기본 옵션

export type MobileAdOptions = {
/** The ad unit ID from AdMob */
adUnitId: string;
};

TrackingAuthorizationStatus

앱 추적 허용 상태 섹션

iOS 앱 추적 허용 상태

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 = '',
}

실제 데이터 원

실제 데이터 원 섹션

이 페이지는 플러그인의 src/definitions.ts. upstream에서 API가 변경될 때마다 다시 동기화할 수 있습니다.

Getting Started에서 계속

Getting Started에서 계속 섹션

Capacitor를 사용 중이라면 Getting Started에서 시작 대시보드와 API 운영을 계획하고 연결하세요. Using @capgo/capacitor-admob Using @capgo/capacitor-admob API 개요 Capacitor API Overview 소개 소개 API 키 Capacitor API Keys 장치 Capacitor Devices