Capacitor 8 plugin for Unity LevelPlay (ironSource) rewarded and interstitial ads. iOS (Swift Package Manager + CocoaPods) and Android. MIT. https://www.npmjs.com/package/capacitor-levelplay
Find a file
CRT 57c8cbd935 Package metadata for the public 0.2.0 release
- package.json: version 0.2.0, description, author VOX Games, homepage,
  bugs, repository, keywords, engines, files (adds CHANGELOG.md)
- @capacitor/docgen: docgen script, run by build; dist/docs.json
- podspec: short summary, homepage from package.json, source at the
  git.crt.fyi repo and tag v<version>
- verify:android: standalone Gradle build of the library (wrapper 8.14.3,
  settings.gradle pointing at @capacitor/android dev dependency)
2026-10-09 18:16:06 +00:00
android Package metadata for the public 0.2.0 release 2026-10-09 18:16:06 +00:00
dist Package metadata for the public 0.2.0 release 2026-10-09 18:16:06 +00:00
ios/Sources/LevelPlayPlugin iOS: LevelPlay ad-unit bridge over SPM (LevelPlay-Swift-Package 9.6.1), ATT, consent 2026-10-09 15:02:07 +00:00
src API docs: JSDoc with @since for every method, option, event and type 2026-10-09 18:16:06 +00:00
.gitignore Scaffold Capacitor 8 plugin package (capacitor-levelplay) 2026-10-09 15:02:07 +00:00
CapacitorLevelplay.podspec Package metadata for the public 0.2.0 release 2026-10-09 18:16:06 +00:00
CHANGELOG.md README and changelog for 0.1.0 2026-10-09 15:02:07 +00:00
LICENSE Scaffold Capacitor 8 plugin package (capacitor-levelplay) 2026-10-09 15:02:07 +00:00
package.json Package metadata for the public 0.2.0 release 2026-10-09 18:16:06 +00:00
Package.swift iOS: LevelPlay ad-unit bridge over SPM (LevelPlay-Swift-Package 9.6.1), ATT, consent 2026-10-09 15:02:07 +00:00
README.md README and changelog for 0.1.0 2026-10-09 15:02:07 +00:00
rollup.config.mjs Scaffold Capacitor 8 plugin package (capacitor-levelplay) 2026-10-09 15:02:07 +00:00
tsconfig.json API docs: JSDoc with @since for every method, option, event and type 2026-10-09 18:16:06 +00:00

capacitor-levelplay

Capacitor 8 plugin for Unity LevelPlay (formerly ironSource) mediation: rewarded and interstitial ads on Android and iOS, using LevelPlay's current ad-unit API (LevelPlay.init, LevelPlayRewardedAd / LPMRewardedAd, LevelPlayInterstitialAd / LPMInterstitialAd). No banners, no native ads.

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 (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

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.

Install

npm install capacitor-levelplay      # or: bun add capacitor-levelplay
npx cap sync

iOS setup

  1. -ObjC linker flag (required by LevelPlay): App target > Build Settings > Other Linker Flags > add -ObjC.
  2. Info.plist:
<!-- ironSource / LevelPlay SKAdNetwork id. Add the ids of every mediated network you enable
     (https://docs.unity.com/en-us/grow/levelplay/sdk/ios/skadnetwork-id-manager). -->
<key>SKAdNetworkItems</key>
<array>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>su67r6k2v3.skadnetwork</string>
  </dict>
</array>
<!-- Shown by the App Tracking Transparency prompt (requestTrackingAuthorization). -->
<key>NSUserTrackingUsageDescription</key>
<string>Your data will be used to deliver ads that are more relevant to you.</string>
<!-- Optional, recommended: copies of SKAN install-validation postbacks. -->
<key>NSAdvertisingAttributionReportEndpoint</key>
<string>https://postbacks-is.com/</string>
<!-- LevelPlay's integration guide asks for arbitrary loads (some ad creatives are served over http). -->
<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
  <true/>
</dict>

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.

Android setup

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).

Optional overrides in the app's android/variables.gradle:

ext {
    levelPlayVersion = '9.6.1'
}

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 page. If you minify, the core keep rules ship as consumer ProGuard rules; add the per-network rules yourself.

Usage

import { LevelPlay, LEVELPLAY_DEMO } from 'capacitor-levelplay';
import { Capacitor } from '@capacitor/core';

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

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
}

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).

Demo ids

LEVELPLAY_DEMO holds the public app keys and ad unit ids from Unity's official sample apps (Mediation-Demo-Apps). They serve test ads; never ship them.

platform app key rewarded interstitial
Android 25b63cf85 syz3d8ekts22q0or h3xw38h9214adgxo
iOS 8545d445 qwouvdrkuwivay5q wmgt0712uuux8ju4

Integration Test Suite

await LevelPlay.initialize({ appKey, testSuite: true }); // sets is_test_suite=enable before init
await LevelPlay.launchTestSuite();

Development builds only. The suite is portrait only.

Privacy

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

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.

On the web the plugin is a stub: initialize rejects as unimplemented, nothing is ever ready and shows resolve { shown: false }.

Development

bun install
bun run build        # dist/ (esm + cjs + iife)
bun run verify:ios   # xcodebuild the Swift package

dist/ is committed so the package can be installed straight from git.

License

MIT (see 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.