From 381b6c02e59848bd18f653a66f74e6276f9d311a Mon Sep 17 00:00:00 2001 From: CRT Date: Fri, 9 Oct 2026 18:16:06 +0000 Subject: [PATCH] README: public documentation with generated API reference Features, compatibility, install, iOS (SPM / CocoaPods) and Android setup, usage guide, mediation adapters, privacy and ATT, troubleshooting, FAQ with a comparison to capacitor-levelplay-ads, and the docgen API section. --- README.md | 1171 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 1086 insertions(+), 85 deletions(-) diff --git a/README.md b/README.md index c27e698..56685d6 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,131 @@ # capacitor-levelplay +[![npm version](https://img.shields.io/npm/v/capacitor-levelplay.svg)](https://www.npmjs.com/package/capacitor-levelplay) +[![license: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) +[![Capacitor 8](https://img.shields.io/badge/Capacitor-8-119eff.svg)](https://capacitorjs.com) +[![LevelPlay SDK 9.6.1](https://img.shields.io/badge/LevelPlay%20SDK-9.6.1-222.svg)](https://docs.unity.com/en-us/grow/levelplay) + Capacitor 8 plugin for [Unity LevelPlay](https://docs.unity.com/en-us/grow/levelplay) (formerly ironSource) mediation: -**rewarded** and **interstitial** ads on Android and iOS, using LevelPlay's current ad-unit API +**rewarded** and **interstitial** ads on Android and iOS, built on LevelPlay's current **ad-unit API** (`LevelPlay.init`, `LevelPlayRewardedAd` / `LPMRewardedAd`, `LevelPlayInterstitialAd` / `LPMInterstitialAd`). -No banners, no native ads. -| | | +```ts +import { LevelPlay } from 'capacitor-levelplay'; + +await LevelPlay.initialize({ appKey: 'your-app-key' }); +await LevelPlay.loadRewarded({ adUnitId: 'your-rewarded-ad-unit' }); +// ... +const result = await LevelPlay.showRewarded({ adUnitId: 'your-rewarded-ad-unit' }); +if (result.rewarded) grantCoins(result.reward!.amount); +``` + +## Contents + +- [Features](#features) +- [Compatibility](#compatibility) +- [Install](#install) +- [iOS setup](#ios-setup) +- [Android setup](#android-setup) +- [Quick start](#quick-start) +- [Usage guide](#usage-guide) +- [Mediation adapters](#mediation-adapters) +- [Privacy and consent](#privacy-and-consent) +- [Troubleshooting](#troubleshooting) +- [FAQ](#faq) +- [API reference](#api) +- [Contributing](#contributing) +- [License](#license) + +## Features + +- **Rewarded and interstitial ads** with LevelPlay's ad-unit API (SDK 9.x). One native ad object per ad unit id, so + several rewarded or interstitial ad units can be used side by side. +- **Promise-based show**: `showRewarded` / `showInterstitial` resolve after the ad closes with + `{ shown, rewarded, reward?, error?, adInfo? }`. They never reject because an ad was not ready, and the plugin handles + networks that deliver the reward after the close callback. +- **Swift Package Manager first on iOS**: the plugin's `Package.swift` depends on Unity's official + [LevelPlay-Swift-Package](https://github.com/ironsource-mobile/LevelPlay-Swift-Package), so `npx cap sync` on an SPM + project really pulls the SDK. A podspec (`IronSourceSDK`) is included for CocoaPods projects. +- **App Tracking Transparency** helper on iOS (`requestTrackingAuthorization`, `getTrackingAuthorizationStatus`). +- **GDPR, CCPA and COPPA** signals through LevelPlay's privacy settings API, settable before init. +- **Integration Test Suite** and **integration validation** (`launchTestSuite`, `validateIntegration`) for checking + adapters during development. +- **Typed events** (`loaded`, `loadFailed`, `displayed`, `displayFailed`, `clicked`, `closed`, `rewarded`) with ad + info including impression revenue. +- **Demo ids** (`LEVELPLAY_DEMO`) from Unity's public sample apps for test ads during development. +- Web stub: on the web nothing is ever ready and shows resolve `{ shown: false }`, so the same game code runs in a + browser. + +Banners and native ads are not supported. + +## Compatibility + +| | Version | |---|---| -| Capacitor | 8 | -| LevelPlay SDK | Android `com.unity3d.ads-mediation:mediation-sdk:9.6.1` (Maven Central) · iOS `9.6.1` via the official [LevelPlay-Swift-Package](https://github.com/ironsource-mobile/LevelPlay-Swift-Package) (`IronSourceSDK` pod for CocoaPods) | -| iOS | 15+, Swift Package Manager first (the plugin's `Package.swift` really pulls the SDK); a podspec is included for CocoaPods projects | -| Android | minSdk 24, Java 21 | +| Capacitor | 8 (`@capacitor/core` >= 8.0.0) | +| Unity LevelPlay SDK | 9.6.1 (Android `com.unity3d.ads-mediation:mediation-sdk:9.6.1`; iOS `LevelPlay-Swift-Package` 9.6.1 up to < 10, or the `IronSourceSDK ~> 9.6.1` pod) | +| iOS | 15.0+ deployment target | +| Xcode | 26+ (Capacitor 8 requirement); tested with Xcode 27 | +| Android | minSdk 24, compileSdk / targetSdk 36 (Capacitor 8 defaults, overridable from `variables.gradle`) | +| Java | JDK 21 for Gradle builds | +| Node.js | 22+ (Capacitor 8 CLI) | -Why another LevelPlay plugin: the existing `capacitor-levelplay-ads` package targets CocoaPods first and its -`Package.swift` does not depend on the LevelPlay SDK; this one is SPM-first, pulls the SDK under SPM, and exposes only -the ad-unit API. +| Plugin | Capacitor | LevelPlay SDK | +|---|---|---| +| 0.2.x | 8 | 9.6.1 | +| 0.1.x | 8 | 9.6.1 | ## Install ```sh -npm install capacitor-levelplay # or: bun add capacitor-levelplay +npm install capacitor-levelplay npx cap sync ``` -### iOS setup +```sh +bun add capacitor-levelplay && bunx cap sync +yarn add capacitor-levelplay && yarn cap sync +pnpm add capacitor-levelplay && pnpm cap sync +``` -1. **`-ObjC` linker flag** (required by LevelPlay): App target > Build Settings > *Other Linker Flags* > add `-ObjC`. -2. **Info.plist**: +## iOS setup + +### Swift Package Manager (default) + +Capacitor 8 projects created with SPM need nothing extra: `npx cap sync` adds the plugin to `CapApp-SPM/Package.swift` +and Xcode resolves the LevelPlay package (a binary xcframework, roughly 27 MB) on the next build. + +### CocoaPods (alternative) + +CocoaPods projects get the `CapacitorLevelplay` pod from `npx cap sync`; it depends on `Capacitor` and +`IronSourceSDK ~> 9.6.1`. Run `pod install` (or `npx cap sync ios`) as usual. Mediation adapters are then added as pods +(`IronSourceAdapter`) in the app's `Podfile`. + +### `-ObjC` linker flag + +LevelPlay requires it: App target > **Build Settings** > **Linking** > **Other Linker Flags** > add `-ObjC`. + +### Info.plist ```xml - + +NSUserTrackingUsageDescription +Your data will be used to deliver ads that are more relevant to you. + + SKAdNetworkItems SKAdNetworkIdentifier su67r6k2v3.skadnetwork + - -NSUserTrackingUsageDescription -Your data will be used to deliver ads that are more relevant to you. - + + NSAdvertisingAttributionReportEndpoint https://postbacks-is.com/ + NSAppTransportSecurity @@ -52,17 +134,32 @@ npx cap sync ``` -With SPM, `npx cap sync` adds the plugin to `CapApp-SPM/Package.swift`; Xcode resolves the LevelPlay package -(binary xcframework, about 27 MB download) on the next build. +**Generating `SKAdNetworkItems`.** `su67r6k2v3.skadnetwork` is LevelPlay's (ironSource Ads) id. Every mediated network +needs its own ids as well. Use Unity's [SKAdNetwork ID manager](https://docs.unity.com/en-us/grow/levelplay/sdk/ios/skadnetwork-id-manager) +to export the combined list for the networks you enable, or merge each network's official list yourself (for example +Unity Ads publishes `https://skan.mz.unity3d.com/v3/partner/skadnetworks.plist.json`). A small script that downloads +the lists, extracts every `xxxxxxxxxx.skadnetwork` id, de-duplicates them and rewrites the `SKAdNetworkItems` array keeps +this repeatable; re-run it whenever you add a network and before each release. Some lists also carry AdAttributionKit +ids (`.adattributionkit`), which go into the `AdNetworkIdentifiers` array. -### Android setup +Full checklist: Unity's [iOS SDK integration](https://docs.unity.com/en-us/grow/levelplay/sdk/ios/sdk-integration) guide. -Nothing beyond `npx cap sync`: the plugin module declares `mediation-sdk` (Maven Central) plus the Play services -`ads-identifier`, `appset` and `basement` artifacts, and the SDK's manifest brings its activities, providers and the -`INTERNET` / `ACCESS_NETWORK_STATE` permissions. The plugin adds `com.google.android.gms.permission.AD_ID` -(remove it with `tools:node="remove"` in a child-directed app). +## Android setup -Optional overrides in the app's `android/variables.gradle`: +Nothing beyond `npx cap sync` for most apps: + +- **Repositories**: the SDK and all LevelPlay adapters are on Maven Central. Capacitor's default + `android/build.gradle` already lists `google()` and `mavenCentral()`; keep both. +- **Permissions**: the plugin's manifest adds `com.google.android.gms.permission.AD_ID` (required for the advertising id + on Android 13+). The SDK's own manifest brings `INTERNET`, `ACCESS_NETWORK_STATE`, its activities and providers. A + child-directed app can strip `AD_ID` from its manifest with `tools:node="remove"`. +- **Dependencies**: the plugin module declares `mediation-sdk` plus the Play services `ads-identifier`, `appset` and + `basement` artifacts the LevelPlay guide asks for. +- **ProGuard / R8**: the core keep rules ship as consumer rules. If you minify, add the per-network rules from Unity's + [Android SDK integration](https://docs.unity.com/en-us/grow/levelplay/sdk/android/sdk-integration) guide for each + adapter you add. + +Optional: pin a different 9.x SDK from the app's `android/variables.gradle`: ```gradle ext { @@ -70,40 +167,163 @@ ext { } ``` -Mediation adapters (Unity Ads, AdMob, AppLovin, ...) go into the app module, e.g. -`implementation 'com.unity3d.ads-mediation:unityads-adapter:5.+'`; see Unity's -[mediation networks](https://docs.unity.com/en-us/grow/levelplay/sdk/android/mediation-networks) page. -If you minify, the core keep rules ship as consumer ProGuard rules; add the per-network rules yourself. +Gradle in Capacitor 8 projects needs **JDK 21** (see [Troubleshooting](#android-build-fails-with-unsupported-class-file-major-version)). -## Usage +## Quick start ```ts -import { LevelPlay, LEVELPLAY_DEMO } from 'capacitor-levelplay'; import { Capacitor } from '@capacitor/core'; +import { LevelPlay, LEVELPLAY_DEMO } from 'capacitor-levelplay'; +// Unity's public demo ids serve test ads. Replace them with your own before release. const ids = Capacitor.getPlatform() === 'ios' ? LEVELPLAY_DEMO.ios : LEVELPLAY_DEMO.android; -await LevelPlay.requestTrackingAuthorization(); // iOS ATT prompt; no-op elsewhere -await LevelPlay.setConsent({ gdprConsent: true, ccpaDoNotSell: false }); // from your CMP -await LevelPlay.initialize({ appKey: ids.appKey }); +export async function startAds(): Promise { + await LevelPlay.requestTrackingAuthorization(); // iOS ATT prompt; resolves 'unavailable' elsewhere + await LevelPlay.initialize({ + appKey: ids.appKey, + consent: { gdprConsent: false }, // until your CMP says otherwise, see "Privacy and consent" + }); + await LevelPlay.loadRewarded({ adUnitId: ids.rewarded }); + await LevelPlay.loadInterstitial({ adUnitId: ids.interstitial }); +} -await LevelPlay.addListener('loaded', (e) => console.log('loaded', e.format, e.adUnitId)); -await LevelPlay.loadRewarded({ adUnitId: ids.rewarded }); - -// later, when the user taps "watch video": -const { ready } = await LevelPlay.isReady({ format: 'rewarded', adUnitId: ids.rewarded }); -if (ready) { - const r = await LevelPlay.showRewarded({ adUnitId: ids.rewarded }); - if (r.rewarded) grantReward(r.reward); - await LevelPlay.loadRewarded({ adUnitId: ids.rewarded }); // preload the next one +export async function watchVideoForCoins(): Promise { + const result = await LevelPlay.showRewarded({ adUnitId: ids.rewarded }); + void LevelPlay.loadRewarded({ adUnitId: ids.rewarded }); // preload the next one + return result.rewarded ? (result.reward?.amount ?? 0) : 0; } ``` -`showRewarded` / `showInterstitial` resolve **after the ad closes** (or failed to display) with -`{ shown, rewarded, reward?, error?, adInfo? }`. They never reject because an ad is not ready; they resolve -`{ shown: false, error: { code: -1, message: 'Ad not ready' } }`. Reward and close callbacks can arrive in either order -on some networks; the plugin waits up to 1 s after the close for a late reward before resolving. Grant rewards only -when `rewarded` is `true` (or on the `rewarded` event). +## Usage guide + +### Initialise with consent + +Initialise once, as early as is sensible, after consent is known (and on iOS after the ATT prompt). Ads can only be +loaded after `initialize` resolves. + +```ts +const { status } = await LevelPlay.requestTrackingAuthorization(); // iOS only, see Privacy and consent + +const { sdkVersion } = await LevelPlay.initialize({ + appKey: ids.appKey, + userId: playerId, // optional: needed for server-to-server reward callbacks + consent: { + gdprConsent: cmpSaysYes, // EEA / UK / CH users: false until a CMP collected consent + ccpaDoNotSell: false, // true if a US user opted out of sale / sharing + coppa: false, // true for child-directed treatment + }, +}); +``` + +`initialize` rejects with the SDK's init error (`code`, `message`); you can call it again later. Calling it after a +successful init resolves immediately, and concurrent calls share one init. + +### Rewarded ads + +```ts +const REWARDED = ids.rewarded; + +await LevelPlay.loadRewarded({ adUnitId: REWARDED }); + +// When the player taps "Watch a video": +const { ready } = await LevelPlay.isReady({ format: 'rewarded', adUnitId: REWARDED }); +if (!ready) { + showToast('No video available right now'); +} else { + const result = await LevelPlay.showRewarded({ adUnitId: REWARDED, placementName: 'DoubleCoins' }); + if (result.rewarded && result.reward) { + grant(result.reward.name, result.reward.amount); + } else if (result.error) { + console.warn('rewarded not shown', result.error.code, result.error.message); + } + await LevelPlay.loadRewarded({ adUnitId: REWARDED }); // always load the next one +} +``` + +- The show promise resolves **after the ad closes** (or failed to display). +- Grant the reward only when `rewarded` is `true`. The reward and close callbacks can arrive in either order on some + networks; the plugin waits up to 1 second after the close for a late reward before resolving. +- When the ad is not ready, the promise resolves `{ shown: false, rewarded: false, error: { code: -1, message: 'Ad not ready' } }`. +- `placementName` is optional and refers to a placement configured in the LevelPlay dashboard (capping, pacing, reward). +- For server-side rewards, pass `userId` to `initialize` and configure server-to-server callbacks in the dashboard. + +### Interstitial ads + +```ts +await LevelPlay.loadInterstitial({ adUnitId: ids.interstitial }); + +// At a natural break, for example between levels: +const result = await LevelPlay.showInterstitial({ adUnitId: ids.interstitial }); +// result.shown tells you whether it was displayed; game flow continues after the close. +void LevelPlay.loadInterstitial({ adUnitId: ids.interstitial }); +``` + +### Listening to events + +Load results arrive only as events, so listen for `loaded` / `loadFailed` if you want to drive UI or retry logic. + +```ts +import type { PluginListenerHandle } from '@capacitor/core'; + +const handles: PluginListenerHandle[] = [ + await LevelPlay.addListener('loaded', (e) => console.log('loaded', e.format, e.adUnitId, e.adInfo?.adNetwork)), + await LevelPlay.addListener('loadFailed', (e) => { + console.warn('load failed', e.format, e.error.code, e.error.message); + setTimeout(() => { + void (e.format === 'rewarded' + ? LevelPlay.loadRewarded({ adUnitId: e.adUnitId }) + : LevelPlay.loadInterstitial({ adUnitId: e.adUnitId })); + }, 30_000); // retry later; use an increasing backoff in production + }), + await LevelPlay.addListener('displayed', (e) => trackImpression(e.adInfo?.revenue, e.adInfo?.adNetwork)), + await LevelPlay.addListener('rewarded', (e) => console.log('reward', e.reward.name, e.reward.amount)), + await LevelPlay.addListener('closed', (e) => resumeAudio()), +]; + +// later +await Promise.all(handles.map((h) => h.remove())); +// or: await LevelPlay.removeAllListeners(); +``` + +Every event carries `{ format: 'rewarded' | 'interstitial', adUnitId, adInfo? }`, plus `error` on `loadFailed` / +`displayFailed` and `reward` on `rewarded`. + +### Checking readiness + +`isReady({ format, adUnitId })` returns the native `isAdReady()` for that ad unit. It is `false` for an ad unit that was +never loaded. Use it to enable or disable a "watch video" button. + +### Integration Test Suite + +The [Integration Test Suite](https://docs.unity.com/en-us/grow/levelplay/sdk/android/integration-test-suite) shows every +configured network, its adapter status and lets you request test ads per network. + +```ts +await LevelPlay.initialize({ appKey: ids.appKey, testSuite: true }); // sets is_test_suite=enable before init +await LevelPlay.launchTestSuite(); +``` + +Development builds only. Unity recommends not calling other LevelPlay APIs before launching the suite, and the suite +supports portrait orientation only. + +### Validate the integration + +```ts +await LevelPlay.validateIntegration(); +``` + +Writes LevelPlay's integration helper report to the native log: the Xcode console on iOS, logcat tag +`IntegrationHelper` on Android (`adb logcat | grep IntegrationHelper`). Each network is listed with its adapter and SDK +version and `VERIFIED` when everything is in place. Remove the call from release builds. + +### Meta data + +Network-specific and SDK flags go through `setMetaData` before init, for example: + +```ts +await LevelPlay.setMetaData({ key: 'is_deviceid_optout', value: 'true' }); +``` ### Demo ids @@ -111,60 +331,841 @@ when `rewarded` is `true` (or on the `rewarded` event). ([Mediation-Demo-Apps](https://github.com/ironsource-mobile/Mediation-Demo-Apps)). They serve test ads; never ship them. -| platform | app key | rewarded | interstitial | +| Platform | App key | Rewarded | Interstitial | |---|---|---|---| | Android | `25b63cf85` | `syz3d8ekts22q0or` | `h3xw38h9214adgxo` | | iOS | `8545d445` | `qwouvdrkuwivay5q` | `wmgt0712uuux8ju4` | -### Integration Test Suite +### Web -```ts -await LevelPlay.initialize({ appKey, testSuite: true }); // sets is_test_suite=enable before init -await LevelPlay.launchTestSuite(); +LevelPlay has no web SDK. On the web `initialize` and `launchTestSuite` reject as unimplemented, `isReady` is always +`false` and shows resolve `{ shown: false, rewarded: false, error: { code: -1, ... } }`. + +## Mediation adapters + +The plugin brings the LevelPlay SDK (which includes ironSource Ads). Every other network is an adapter plus that +network's SDK, added **to your app**, not to the plugin. Pick versions from Unity's adapter tables +([Android](https://docs.unity.com/en-us/grow/levelplay/sdk/android/mediation-networks), +[iOS](https://docs.unity.com/en-us/grow/levelplay/sdk/ios/mediation-networks)) and take each adapter together with the +network SDK version it was built for (the adapter changelog says "Supporting SDK version ..."). Then enable the network +in the LevelPlay dashboard. + +### Android (Gradle) + +Adapters live on Maven Central under `com.unity3d.ads-mediation:-adapter:`. Add each adapter and the +network SDK to `android/app/build.gradle`: + +```gradle +dependencies { + // Unity Ads + implementation 'com.unity3d.ads-mediation:unityads-adapter:' + implementation 'com.unity3d.ads:unity-ads:' + // Liftoff Monetize (Vungle) + implementation 'com.unity3d.ads-mediation:vungle-adapter:' + implementation 'com.vungle:vungle-ads:' +} ``` -Development builds only. The suite is portrait only. +List the network SDK explicitly: the adapter artifacts do not pull it in. Some networks need more (Google AdMob, for +example, needs its `com.google.android.gms.ads.APPLICATION_ID` meta-data in `AndroidManifest.xml`, or the app crashes at +launch); check the network's page in Unity's docs. -### Privacy +### iOS (Swift Package Manager) -`setConsent({ gdprConsent?, ccpaDoNotSell?, coppa? })` maps to `LevelPlayPrivacySettings` (Android) / -`LPMPrivacySettings` (iOS): `setGDPRConsent`, `setCCPA`, `setCOPPA` (SDK 9.5+ APIs). Call it before `initialize` -(or pass `consent` to `initialize`). LevelPlay also reads a Google UMP / IAB TCF CMP's consent string by itself. -Raw meta data flags (for example `is_deviceid_optout`) go through `setMetaData({ key, value })`. +Unity publishes official adapter packages on GitHub as +`https://github.com/ironsource-mobile/LevelPlay--Adapter-Swift-Package` (for example +`LevelPlay-UnityAds-Adapter-Swift-Package`, `LevelPlay-Vungle-Adapter-Swift-Package`). In Xcode: **File > Add Package +Dependencies**, enter the URL, choose an exact version and add the product to the **App** target. Each package pulls +its network SDK and LevelPlay-Swift-Package 9.x, which resolves to the same copy the plugin uses. + +**Networks without an official Swift package.** Not every network has one (at the time of writing, InMobi does not). +Two options: + +1. Use CocoaPods for the project and add the `IronSourceAdapter` pod. +2. Keep SPM and wrap the adapter in a small **local Swift package** that mirrors the official packages: a + `binaryTarget` pointing at the adapter zip Unity publishes for CocoaPods (the URL is in the adapter's podspec, pin its + SHA-256 with `swift package compute-checksum`), a dependency on the network's own Swift package at the version the + adapter supports, a dependency on `LevelPlay-Swift-Package` 9.x, and an empty Swift source file for the wrapper + target. Add the local package to the App target via **Add Package Dependencies > Add Local...**. + + ```swift + // swift-tools-version: 5.9 + import PackageDescription + + let package = Package( + name: "LevelPlay-Example-Adapter", + platforms: [.iOS(.v13)], + products: [.library(name: "ExampleAdapter", targets: ["ExampleAdapter"])], + dependencies: [ + .package(url: "https://github.com//SDK-Swift-Package.git", exact: ""), + .package(url: "https://github.com/ironsource-mobile/LevelPlay-Swift-Package.git", "9.0.0"..<"10.0.0"), + ], + targets: [ + .target( + name: "ExampleAdapter", // Sources/ExampleAdapter/ExampleAdapter.swift can be empty + dependencies: [ + "ExampleAdapterBinary", + .product(name: "", package: "SDK-Swift-Package"), + .product(name: "UnityMediationSDK", package: "LevelPlay-Swift-Package"), + ]), + .binaryTarget( + name: "ExampleAdapterBinary", + url: "", + checksum: ""), + ] + ) + ``` + + Add any system libraries the network's manual-integration guide lists as `linkerSettings`. + +After adding networks: update `SKAdNetworkItems` ([iOS setup](#infoplist)), rebuild both platforms and run +`validateIntegration()`. + +## Privacy and consent + +LevelPlay recommends setting privacy signals **before** `initialize`. Pass them as `consent` to `initialize` or call +`setConsent` first; call `setConsent` again whenever the user changes their choice. They map to +`LevelPlayPrivacySettings` (Android) and `LPMPrivacySettings` (iOS): `setGDPRConsent`, `setCCPA`, `setCOPPA`. See +Unity's [regulation settings](https://docs.unity.com/en-us/grow/levelplay/sdk/ios/regulation-advanced-settings). + +- **GDPR (EEA, UK, Switzerland)**: pass `gdprConsent: false` until a consent management platform (CMP) collected + consent, then `true` or `false` according to the user's choice. If you use an IAB TCF v2 CMP (for example Google + UMP), LevelPlay and many networks also read the TCF consent string the CMP stores on the device. +- **CCPA and other US state laws**: `ccpaDoNotSell: true` when the user opted out of the sale or sharing of personal + data. +- **COPPA**: `coppa: true` for users who must get child-directed treatment. Child-directed apps should also strip the + `AD_ID` permission on Android and should not show the ATT prompt. + +### App Tracking Transparency (iOS) + +Without ATT authorization the IDFA is zeros and ads earn less, so ask before init: + +1. Add `NSUserTrackingUsageDescription` to `Info.plist`. +2. Call `requestTrackingAuthorization()` **when the app is active** (iOS ignores the request while the app is still + launching or in the background) and **before** `initialize`. Show your CMP first if you have one. +3. iOS shows the system prompt only once; later calls resolve the stored status. Use + `getTrackingAuthorizationStatus()` to read it without prompting. + +```ts +const { status } = await LevelPlay.getTrackingAuthorizationStatus(); +if (status === 'notDetermined') await LevelPlay.requestTrackingAuthorization(); +await LevelPlay.initialize({ appKey }); +``` + +## Troubleshooting + +### Loads fail with 509 "No fill" +Common and usually not a bug. An app that is not live in its store yet (or not approved in the LevelPlay dashboard) +gets little or no real demand. Use the demo ids (`LEVELPLAY_DEMO`) or the Integration Test Suite with test ads to +check your integration, and retry loads with a backoff in production. Unity's +[troubleshooting guide](https://docs.unity.com/en-us/grow/levelplay/sdk/ios/troubleshoot-no-ads-displaying) lists +more causes. + +### Unity Ads: "Invalid Game ID" +The Unity Ads adapter is started with the game id configured on the Unity Ads instance in LevelPlay. If Unity Ads +answers "Invalid Game ID: ..." (iOS: "Initialization failed: not found"), the Unity Ads project or game is not +active, or the instance uses a game id from another project. Check the game ids in the Unity dashboard and that they +belong to the project linked to your LevelPlay app. + +### Android build fails with "Unsupported class file major version" +Gradle for Capacitor 8 must run on **JDK 21**. Android Studio's bundled runtime can be newer than the Gradle version +supports (for example "Unsupported class file major version 69" with Java 25). Point Gradle at a JDK 21: + +```sh +export JAVA_HOME=$(/usr/libexec/java_home -v 21) # macOS +cd android && ./gradlew assembleDebug +``` + +In Android Studio: **Settings > Build, Execution, Deployment > Build Tools > Gradle > Gradle JDK**. + +### iOS: "No such module 'IronSource'" or the package does not update +- Run `npx cap sync ios` after every install or upgrade of the plugin; it rewrites `CapApp-SPM/Package.swift`. +- In Xcode: **File > Packages > Reset Package Caches**, then **Resolve Package Versions**. +- Still stuck: quit Xcode, delete `~/Library/Developer/Xcode/DerivedData/-*` and + `~/Library/Caches/org.swift.swiftpm`, then reopen. +- CocoaPods projects: `cd ios/App && pod install --repo-update`. + +### iOS: crash or missing symbols at launch +Check the `-ObjC` linker flag on the App target. + +### Nothing happens on `showRewarded` +`showRewarded` resolves `{ shown: false, error: { code: -1, message: 'Ad not ready' } }` when no ad is loaded for that ad +unit. Make sure you called `loadRewarded` with the same `adUnitId` after `initialize` resolved, and wait for the +`loaded` event (or `isReady`). + +## FAQ + +**Which LevelPlay API does it use?** +LevelPlay's ad-unit API, the current API in SDK 9.x: `LevelPlay.init` with an init request, +`LevelPlayRewardedAd` / `LevelPlayInterstitialAd` on Android and `LPMRewardedAd` / `LPMInterstitialAd` on iOS. The +legacy `IronSource.*` placement API is not used. + +**Can I use more than one ad unit per format?** +Yes. Every call takes an `adUnitId`, and the plugin keeps one native ad object per id. + +**Does it support banners or native ads?** +No. It focuses on full-screen formats. + +**How is this different from `capacitor-levelplay-ads`?** +Both are Capacitor 8 plugins for LevelPlay and both use the ad-unit API. The differences, as of `capacitor-levelplay-ads` +0.1.42: + +| | `capacitor-levelplay` | `capacitor-levelplay-ads` | +|---|---|---| +| iOS integration | SPM first: `Package.swift` depends on `LevelPlay-Swift-Package`; podspec as alternative | CocoaPods first; its `Package.swift` does not depend on the SDK (SDK code is compiled out unless you add a package yourself) | +| Formats | rewarded, interstitial | banner, rewarded, interstitial | +| Ad units | any number per format side by side, addressed by `adUnitId` | one ad object per format at a time | +| Show result | promise resolves after close with `{ shown, rewarded, reward }` | outcome via events | +| Consent | GDPR / CCPA / COPPA flags; bring your own CMP | built-in consent flows (own consent modal, optional Usercentrics / InMobi CMP) | +| Adapters | added by the app (Gradle / Swift packages / pods) | helper script that injects adapter pods from `package.json` | + +Pick the one that fits your project. + +**Is the LevelPlay SDK bundled?** +No. The plugin declares the SDK as a dependency (Maven Central, Swift package or pod). The SDK is proprietary and +covered by Unity's terms. ## API -| method | description | -|---|---| -| `initialize({ appKey, userId?, testSuite?, adaptersDebug?, consent? })` | `LevelPlay.init`; resolves `{ sdkVersion }` on success, rejects with the init error. Idempotent. | -| `getSdkVersion()` | `{ sdkVersion }` | -| `setConsent({ gdprConsent?, ccpaDoNotSell?, coppa? })` | privacy signals | -| `setMetaData({ key, value })` | `LevelPlay.setMetaData` | -| `requestTrackingAuthorization()` / `getTrackingAuthorizationStatus()` | iOS ATT, `{ status }`; `unavailable` on Android / web | -| `loadRewarded({ adUnitId })` / `loadInterstitial({ adUnitId })` | start a load; outcome via `loaded` / `loadFailed` | -| `showRewarded({ adUnitId, placementName? })` / `showInterstitial(...)` | show; resolves after close with the result | -| `isReady({ format, adUnitId })` | `{ ready }` | -| `launchTestSuite()` | LevelPlay Integration Test Suite | -| `validateIntegration()` | integration helper report in the native log | + -Events (`addListener`): `loaded`, `loadFailed`, `displayed`, `displayFailed`, `clicked`, `closed`, `rewarded`. -Every event carries `{ format: 'rewarded' | 'interstitial', adUnitId, adInfo? }`, plus `error` (failures) or `reward`. -Full types with JSDoc: [`src/definitions.ts`](src/definitions.ts). +* [`initialize(...)`](#initialize) +* [`getSdkVersion()`](#getsdkversion) +* [`setConsent(...)`](#setconsent) +* [`setMetaData(...)`](#setmetadata) +* [`requestTrackingAuthorization()`](#requesttrackingauthorization) +* [`getTrackingAuthorizationStatus()`](#gettrackingauthorizationstatus) +* [`loadRewarded(...)`](#loadrewarded) +* [`showRewarded(...)`](#showrewarded) +* [`loadInterstitial(...)`](#loadinterstitial) +* [`showInterstitial(...)`](#showinterstitial) +* [`isReady(...)`](#isready) +* [`launchTestSuite()`](#launchtestsuite) +* [`validateIntegration()`](#validateintegration) +* [`addListener('loaded', ...)`](#addlistenerloaded-) +* [`addListener('loadFailed', ...)`](#addlistenerloadfailed-) +* [`addListener('displayed', ...)`](#addlistenerdisplayed-) +* [`addListener('displayFailed', ...)`](#addlistenerdisplayfailed-) +* [`addListener('clicked', ...)`](#addlistenerclicked-) +* [`addListener('closed', ...)`](#addlistenerclosed-) +* [`addListener('rewarded', ...)`](#addlistenerrewarded-) +* [`removeAllListeners()`](#removealllisteners) +* [Interfaces](#interfaces) +* [Type Aliases](#type-aliases) -On the web the plugin is a stub: `initialize` rejects as unimplemented, nothing is ever ready and shows resolve -`{ shown: false }`. + -## Development + + + +Unity LevelPlay rewarded and interstitial ads (ad-unit API). + +### initialize(...) + +```typescript +initialize(options: InitOptions) => Promise +``` + +Initialise the LevelPlay SDK (`LevelPlay.init`). Resolves on init success, rejects with the init error +(code and message from the SDK) otherwise. Calling it again after a successful init resolves immediately; +concurrent calls share one init. Load ads only after this resolves. + +Set consent (and on iOS ask for ATT) before calling it. + +On the web it rejects as unimplemented. + +| Param | Type | +| ------------- | --------------------------------------------------- | +| **`options`** | InitOptions | + +**Returns:** Promise<InitResult> + +**Since:** 0.1.0 + +-------------------- + + +### getSdkVersion() + +```typescript +getSdkVersion() => Promise +``` + +Native LevelPlay SDK version. Works before init. + +**Returns:** Promise<InitResult> + +**Since:** 0.1.0 + +-------------------- + + +### setConsent(...) + +```typescript +setConsent(options: ConsentOptions) => Promise +``` + +Forward GDPR / CCPA / COPPA signals to LevelPlay. Call it before `initialize()` when you +can, and again whenever the user changes their choice. + +| Param | Type | +| ------------- | --------------------------------------------------------- | +| **`options`** | ConsentOptions | + +**Since:** 0.1.0 + +-------------------- + + +### setMetaData(...) + +```typescript +setMetaData(options: MetaDataOptions) => Promise +``` + +Raw `LevelPlay.setMetaData(key, value)` for SDK or network-specific flags. Call it before init. + +| Param | Type | +| ------------- | ----------------------------------------------------------- | +| **`options`** | MetaDataOptions | + +**Since:** 0.1.0 + +-------------------- + + +### requestTrackingAuthorization() + +```typescript +requestTrackingAuthorization() => Promise +``` + +iOS: show the App Tracking Transparency prompt and resolve with the resulting status. Needs +`NSUserTrackingUsageDescription` in `Info.plist`. iOS only shows the prompt once; later calls resolve the stored +status. Call it before `initialize()`, while the app is active. + +Android and web: resolves `unavailable`. + +**Returns:** Promise<TrackingResult> + +**Since:** 0.1.0 + +-------------------- + + +### getTrackingAuthorizationStatus() + +```typescript +getTrackingAuthorizationStatus() => Promise +``` + +Current App Tracking Transparency status without prompting (iOS). Android and web: `unavailable`. + +**Returns:** Promise<TrackingResult> + +**Since:** 0.1.0 + +-------------------- + + +### loadRewarded(...) + +```typescript +loadRewarded(options: AdUnitOptions) => Promise +``` + +Start loading a rewarded ad for the ad unit. The native ad object is created on first use and reused for the +ad unit. Resolves once the request is issued; the outcome arrives as a `loaded` or `loadFailed` event. +Load the next ad after each show. + +| Param | Type | +| ------------- | ------------------------------------------------------- | +| **`options`** | AdUnitOptions | + +**Since:** 0.1.0 + +-------------------- + + +### showRewarded(...) + +```typescript +showRewarded(options: ShowOptions) => Promise +``` + +Show a loaded rewarded ad. Resolves after the ad closed (or failed to display) with what happened. The reward +and close callbacks can arrive in either order on some networks, so the plugin waits up to 1 second after the close +for a late reward. Never rejects for "not ready": resolves `{ shown: false, rewarded: false, error }` instead. + +| Param | Type | +| ------------- | --------------------------------------------------- | +| **`options`** | ShowOptions | + +**Returns:** Promise<ShowResult> + +**Since:** 0.1.0 + +-------------------- + + +### loadInterstitial(...) + +```typescript +loadInterstitial(options: AdUnitOptions) => Promise +``` + +Start loading an interstitial ad for the ad unit. Works like `loadRewarded()`. + +| Param | Type | +| ------------- | ------------------------------------------------------- | +| **`options`** | AdUnitOptions | + +**Since:** 0.1.0 + +-------------------- + + +### showInterstitial(...) + +```typescript +showInterstitial(options: ShowOptions) => Promise +``` + +Show a loaded interstitial. Resolves after it closed (or failed to display). Never rejects for "not ready". + +| Param | Type | +| ------------- | --------------------------------------------------- | +| **`options`** | ShowOptions | + +**Returns:** Promise<ShowResult> + +**Since:** 0.1.0 + +-------------------- + + +### isReady(...) + +```typescript +isReady(options: IsReadyOptions) => Promise +``` + +`isAdReady()` of the native ad object for this ad unit. `false` when the ad unit was never loaded. + +| Param | Type | +| ------------- | --------------------------------------------------------- | +| **`options`** | IsReadyOptions | + +**Returns:** Promise<IsReadyResult> + +**Since:** 0.1.0 + +-------------------- + + +### launchTestSuite() + +```typescript +launchTestSuite() => Promise +``` + +Open the LevelPlay Integration Test Suite. Requires `initialize({ testSuite: true })` first. +Development builds only. Rejects on the web. + +**Since:** 0.1.0 + +-------------------- + + +### validateIntegration() + +```typescript +validateIntegration() => Promise +``` + +Write the LevelPlay integration helper report to the native log (Xcode console; Android logcat tag +`IntegrationHelper`): SDK, adapter and network SDK versions, each `VERIFIED` or not. Development only. + +**Since:** 0.1.0 + +-------------------- + + +### addListener('loaded', ...) + +```typescript +addListener(eventName: 'loaded', listenerFunc: (event: AdEvent) => void) => Promise +``` + +An ad finished loading for the ad unit and can be shown. + +| Param | Type | +| ------------------ | --------------------------------------------------------------- | +| **`eventName`** | 'loaded' | +| **`listenerFunc`** | (event: AdEvent) => void | + +**Returns:** Promise<PluginListenerHandle> + +**Since:** 0.1.0 + +-------------------- + + +### addListener('loadFailed', ...) + +```typescript +addListener(eventName: 'loadFailed', listenerFunc: (event: AdErrorEvent) => void) => Promise +``` + +Loading failed, for example `509` (no fill). Retry later with a backoff. + +| Param | Type | +| ------------------ | ------------------------------------------------------------------------- | +| **`eventName`** | 'loadFailed' | +| **`listenerFunc`** | (event: AdErrorEvent) => void | + +**Returns:** Promise<PluginListenerHandle> + +**Since:** 0.1.0 + +-------------------- + + +### addListener('displayed', ...) + +```typescript +addListener(eventName: 'displayed', listenerFunc: (event: AdEvent) => void) => Promise +``` + +The ad was displayed (impression). `adInfo.revenue` is available here. + +| Param | Type | +| ------------------ | --------------------------------------------------------------- | +| **`eventName`** | 'displayed' | +| **`listenerFunc`** | (event: AdEvent) => void | + +**Returns:** Promise<PluginListenerHandle> + +**Since:** 0.1.0 + +-------------------- + + +### addListener('displayFailed', ...) + +```typescript +addListener(eventName: 'displayFailed', listenerFunc: (event: AdErrorEvent) => void) => Promise +``` + +The ad failed to display. The pending show call resolves with the same error. + +| Param | Type | +| ------------------ | ------------------------------------------------------------------------- | +| **`eventName`** | 'displayFailed' | +| **`listenerFunc`** | (event: AdErrorEvent) => void | + +**Returns:** Promise<PluginListenerHandle> + +**Since:** 0.1.0 + +-------------------- + + +### addListener('clicked', ...) + +```typescript +addListener(eventName: 'clicked', listenerFunc: (event: AdEvent) => void) => Promise +``` + +The user clicked the ad. + +| Param | Type | +| ------------------ | --------------------------------------------------------------- | +| **`eventName`** | 'clicked' | +| **`listenerFunc`** | (event: AdEvent) => void | + +**Returns:** Promise<PluginListenerHandle> + +**Since:** 0.1.0 + +-------------------- + + +### addListener('closed', ...) + +```typescript +addListener(eventName: 'closed', listenerFunc: (event: AdEvent) => void) => Promise +``` + +The ad was closed and the app is back in front. + +| Param | Type | +| ------------------ | --------------------------------------------------------------- | +| **`eventName`** | 'closed' | +| **`listenerFunc`** | (event: AdEvent) => void | + +**Returns:** Promise<PluginListenerHandle> + +**Since:** 0.1.0 + +-------------------- + + +### addListener('rewarded', ...) + +```typescript +addListener(eventName: 'rewarded', listenerFunc: (event: AdRewardEvent) => void) => Promise +``` + +Rewarded only: the user earned the reward. Can fire before or after `closed`. + +| Param | Type | +| ------------------ | --------------------------------------------------------------------------- | +| **`eventName`** | 'rewarded' | +| **`listenerFunc`** | (event: AdRewardEvent) => void | + +**Returns:** Promise<PluginListenerHandle> + +**Since:** 0.1.0 + +-------------------- + + +### removeAllListeners() + +```typescript +removeAllListeners() => Promise +``` + +Remove every listener of this plugin. + +**Since:** 0.1.0 + +-------------------- + + +### Interfaces + + +#### InitResult + +Result of `initialize()` and `getSdkVersion()`. + +| Prop | Type | Description | Since | +| ---------------- | ------------------- | -------------------------------------------------------------------- | ----- | +| **`sdkVersion`** | string | Native LevelPlay SDK version, for example `9.6.1`. `web` on the web. | 0.1.0 | + + +#### InitOptions + +Options for `initialize()`. + +| Prop | Type | Description | Default | Since | +| ------------------- | --------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ----- | +| **`appKey`** | string | LevelPlay app key from the LevelPlay dashboard. Android and iOS apps have different keys. | | 0.1.0 | +| **`userId`** | string | Optional user id. Needed for server-to-server reward callbacks and the Ad Quality user journey. | | 0.1.0 | +| **`testSuite`** | boolean | Enable the LevelPlay Integration Test Suite: sets the `is_test_suite=enable` meta data before init. Call `launchTestSuite()` after `initialize` resolves. Never ship this enabled. | false | 0.1.0 | +| **`adaptersDebug`** | boolean | Turn on debug logs of the mediated ad network adapters (`LevelPlay.setAdaptersDebug(true)`). Development only. | false | 0.1.0 | +| **`consent`** | ConsentOptions | Privacy signals applied right before init (LevelPlay recommends setting them before the SDK starts). Same as calling `setConsent()` first. | | 0.1.0 | + + +#### ConsentOptions + +Privacy signals forwarded to LevelPlay (`LevelPlayPrivacySettings` on Android, `LPMPrivacySettings` on iOS). +Omitted fields are left untouched. + +| Prop | Type | Description | Since | +| ------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----- | +| **`gdprConsent`** | boolean | GDPR: `true` when the user consented to personalised ads and data processing, `false` when they did not. For users in the EEA, UK and Switzerland pass `false` until a consent management platform (CMP) says otherwise. | 0.1.0 | +| **`ccpaDoNotSell`** | boolean | CCPA and other US state privacy laws: `true` when the user opted OUT of the sale or sharing of personal data ("do not sell"), `false` otherwise. | 0.1.0 | +| **`coppa`** | boolean | COPPA: `true` when the user must be treated as a child (child-directed treatment). | 0.1.0 | + + +#### MetaDataOptions + +Options for `setMetaData()`. + +| Prop | Type | Description | Since | +| ----------- | ------------------- | --------------------------------------------------------------------------------------------- | ----- | +| **`key`** | string | Meta data key, for example `is_deviceid_optout` or a network-specific flag from Unity's docs. | 0.1.0 | +| **`value`** | string | Meta data value, always a string (for example `"true"`). | 0.1.0 | + + +#### TrackingResult + +Result of `requestTrackingAuthorization()` and +`getTrackingAuthorizationStatus()`. + +| Prop | Type | Description | Since | +| ------------ | --------------------------------------------------------- | ------------------------------------------------------------------------------ | ----- | +| **`status`** | TrackingStatus | iOS App Tracking Transparency status. Always `unavailable` on Android and web. | 0.1.0 | + + +#### AdUnitOptions + +Identifies one ad unit. + +| Prop | Type | Description | Since | +| -------------- | ------------------- | ----------------------------------------------------------------------------------------------------- | ----- | +| **`adUnitId`** | string | Ad unit id from the LevelPlay dashboard (Ad units page). Android and iOS ad units have different ids. | 0.1.0 | + + +#### ShowResult + +Result of `showRewarded()` and `showInterstitial()`, resolved after the ad +closed or failed to display. + +| Prop | Type | Description | Since | +| -------------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ----- | +| **`shown`** | boolean | The ad was displayed (the `displayed` event fired). | 0.1.0 | +| **`rewarded`** | boolean | Rewarded only: the reward callback fired for this show. Grant the reward only when this is `true`. Always `false` for interstitials. | 0.1.0 | +| **`reward`** | Reward | The reward, present when `rewarded` is `true`. | 0.1.0 | +| **`error`** | AdError | Present when the ad was not ready (`code: -1`) or failed to display. | 0.1.0 | +| **`adInfo`** | AdInfo | Info of the displayed ad. | 0.1.0 | + + +#### Reward + +The reward of a rewarded ad, as configured in the LevelPlay dashboard (per ad unit or placement). + +| Prop | Type | Description | Since | +| ------------ | ------------------- | ---------------------------------------- | ----- | +| **`name`** | string | Name of the reward, for example `Coins`. | 0.1.0 | +| **`amount`** | number | Amount of the reward. | 0.1.0 | + + +#### AdError + +Error reported by the SDK (load / display failures) or by the plugin. + +| Prop | Type | Description | Since | +| ------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------- | ----- | +| **`code`** | number | LevelPlay error code, for example `509` (no fill). `-1` is used by the plugin for "Ad not ready" and for the web stub. | 0.1.0 | +| **`message`** | string | Human readable message. | 0.1.0 | + + +#### AdInfo + +Subset of the native `LevelPlayAdInfo` (Android) / `LPMAdInfo` (iOS) that is useful in JavaScript. +Fields the SDK does not report are omitted. + +| Prop | Type | Description | Since | +| ------------------- | ------------------- | ------------------------------------------------------------------------------------- | ----- | +| **`adId`** | string | Unique id of this ad. | 0.1.0 | +| **`adUnitId`** | string | Ad unit id. | 0.1.0 | +| **`adUnitName`** | string | Ad unit name from the dashboard. | 0.1.0 | +| **`adFormat`** | string | Ad format as reported by the SDK. | 0.1.0 | +| **`placementName`** | string | Placement name of the show call, when one was used. | 0.1.0 | +| **`adNetwork`** | string | Name of the mediated network that served the ad. | 0.1.0 | +| **`instanceName`** | string | Mediation instance name. | 0.1.0 | +| **`instanceId`** | string | Mediation instance id. | 0.1.0 | +| **`country`** | string | Country code of the impression. | 0.1.0 | +| **`auctionId`** | string | Auction id. | 0.1.0 | +| **`revenue`** | number | Impression revenue in USD as reported by the SDK (may be absent or 0 before display). | 0.1.0 | +| **`precision`** | string | Revenue precision as reported by the SDK. | 0.1.0 | + + +#### ShowOptions + +Options for `showRewarded()` and `showInterstitial()`: `adUnitId` (see AdUnitOptions) plus an optional placement. + +| Prop | Type | Description | Since | +| ------------------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ----- | +| **`placementName`** | string | Optional placement name configured in the LevelPlay dashboard (capping, pacing and reward per placement). Omit it to use the default placement. | 0.1.0 | + + +#### IsReadyResult + +Result of `isReady()`. + +| Prop | Type | Description | Since | +| ----------- | -------------------- | ----------------------------------------------- | ----- | +| **`ready`** | boolean | `true` when a loaded ad can be shown right now. | 0.1.0 | + + +#### IsReadyOptions + +Options for `isReady()`: `adUnitId` (see AdUnitOptions) plus the format. + +| Prop | Type | Description | Since | +| ------------ | --------------------------------------------- | ---------------------- | ----- | +| **`format`** | AdFormat | Format of the ad unit. | 0.1.0 | + + +#### PluginListenerHandle + +| Prop | Type | +| ------------ | ----------------------------------------- | +| **`remove`** | () => Promise<void> | + + +#### AdEvent + +Payload of the `loaded`, `displayed`, `clicked` and `closed` events. + +| Prop | Type | Description | Since | +| -------------- | --------------------------------------------- | -------------------------------------------------------- | ----- | +| **`format`** | AdFormat | Format of the ad unit that fired the event. | 0.1.0 | +| **`adUnitId`** | string | Ad unit that fired the event. | 0.1.0 | +| **`adInfo`** | AdInfo | Ad info, when the SDK provides it (not on `loadFailed`). | 0.1.0 | + + +#### AdErrorEvent + +Payload of the `loadFailed` and `displayFailed` events: the AdEvent fields plus `error`. + +| Prop | Type | Description | Since | +| ----------- | ------------------------------------------- | ---------------- | ----- | +| **`error`** | AdError | What went wrong. | 0.1.0 | + + +#### AdRewardEvent + +Payload of the `rewarded` event: the AdEvent fields plus `reward`. + +| Prop | Type | Description | Since | +| ------------ | ----------------------------------------- | ------------------ | ----- | +| **`reward`** | Reward | The reward earned. | 0.1.0 | + + +### Type Aliases + + +#### TrackingStatus + +iOS App Tracking Transparency status. `unavailable` on Android, on the web and on unknown future iOS values. + +'authorized' | 'denied' | 'restricted' | 'notDetermined' | 'unavailable' + + +#### AdFormat + +Full-screen ad formats supported by this plugin. Banners and native ads are intentionally not exposed. + +'rewarded' | 'interstitial' + + + +## Contributing + +Issues and pull requests are welcome on the [issue tracker](https://git.crt.fyi/CRT/capacitor-levelplay/issues). See +[CONTRIBUTING.md](CONTRIBUTING.md). ```sh bun install -bun run build # dist/ (esm + cjs + iife) -bun run verify:ios # xcodebuild the Swift package +bun run build # docgen + dist/ (esm, cjs, iife) +bun run typecheck +bun run verify:ios # xcodebuild the Swift package for the iOS simulator +bun run verify:android # Gradle build of the Android library (JDK 21, Android SDK) ``` -`dist/` is committed so the package can be installed straight from git. +Release notes: [CHANGELOG.md](CHANGELOG.md). ## License -MIT (see [LICENSE](LICENSE)). The Unity LevelPlay SDK itself is proprietary and governed by Unity's terms; this -plugin only declares it as a dependency and does not redistribute it. +[MIT](LICENSE) © [VOX Games](https://vox.games) + +The Unity LevelPlay SDK and the mediated network SDKs are proprietary and governed by their owners' terms. This plugin +only declares them as dependencies and does not redistribute them. LevelPlay, ironSource and Unity are trademarks of +Unity Technologies; this project is not affiliated with or endorsed by Unity.