コンテンツにジャンプ

Getting Started

GitHub

CapgoのAIアシストされたセットアップを使用してプラグインをインストールできます。AIツールにCapgoスキルを追加するには、以下のコマンドを使用してください。

ターミナル画面
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

Then use the following prompt:

Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-admob` plugin in my project.

If you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:

ターミナル画面
bun add @capgo/capacitor-admob
bunx cap sync
import { AdMob } from '@capgo/capacitor-admob';

AdMob SDK を初期化して開始する

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

__CAPGO_KEEP_2__

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

configRequest

__CAPGO_KEEP_1__

__CAPGO_KEEP_3__

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

__CAPGO_KEEP_0__

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

__CAPGO_KEEP_0__

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 });

__CAPGO_KEEP_4__

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

__CAPGO_KEEP_1__

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

trackingAuthorizationStatus

__CAPGO_KEEP_0__

__CAPGO_KEEP_7__

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

requestTrackingAuthorization

__CAPGO_KEEP_1__

__CAPGO_KEEP_2__

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

__CAPGO_KEEP_3__

__CAPGO_KEEP_1__

AdMobConfig

__CAPGO_KEEP_4__

__CAPGO_KEEP_5__

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

RequestConfig

__CAPGO_KEEP_7__

__CAPGO_KEEP_0__

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 App Tracking Transparencyのトラッキング承認状態

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 が変更されたときに、再度 sync を実行してください。

Getting Started から続けてください。

Getting Started から続けてください。

Getting Started から続けてください。 Getting Started から続けてください。 to plan dashboard and API operations, connect it with Using @capgo/capacitor-admob for the native capability in Using @capgo/capacitor-admob, API Overview for the implementation detail in API Overview, Getting Started から続けてください。 あなたが使用している場合、 API キー API キーと デバイス デバイスの実装詳細