Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/levelplay/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ for React Native.
- 🎯 LevelPlay (ironSource) mediation — interstitial and rewarded video
- ⚡️ [Nitro Modules](https://nitro.margelo.com/) — direct JSI bindings, no bridge overhead
- 📱 iOS & Android
- 🧩 Expo config plugin included — adds LevelPlay's Maven repo automatically
- 🧩 Expo CNG supported
- 🔒 Fully typed API

## Installation
Expand Down
2 changes: 1 addition & 1 deletion packages/liftoff/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Native.
- 🎯 Liftoff Monetize (Vungle) — interstitial and rewarded video
- ⚡️ [Nitro Modules](https://nitro.margelo.com/) — direct JSI bindings, no bridge overhead
- 📱 iOS & Android
- 🧩 Works with Expo out of the box — no config plugin needed
- 🧩 Expo CNG supported
- 🔒 Fully typed API

## Installation
Expand Down
2 changes: 1 addition & 1 deletion packages/pangle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Pangle — interstitial and rewarded video ads for React Native.
- 🎯 Pangle — interstitial and rewarded video
- ⚡️ [Nitro Modules](https://nitro.margelo.com/) — direct JSI bindings, no bridge overhead
- 📱 iOS & Android
- 🧩 Expo config plugin included — adds Pangle's Maven repo automatically
- 🧩 Expo CNG supported
- 🔒 Fully typed API

## Installation
Expand Down
55 changes: 36 additions & 19 deletions packages/ump/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,25 @@ Google User Messaging Platform (UMP) — GDPR/CCPA consent for React Native.
- 🔐 Google UMP — GDPR/CCPA consent gathering and the privacy options form
- ⚡️ [Nitro Modules](https://nitro.margelo.com/) — direct JSI bindings, no bridge overhead
- 📱 iOS & Android
- 🧩 Works with Expo out of the box — no config plugin needed
- 🧩 Expo CNG supported
- 🔒 Fully typed API

## Installation

The UMP SDK refuses to run without a Google-issued AdMob App ID, even if you
don't use AdMob/Google Mobile Ads — omitting it throws
`The UMP SDK requires a valid application ID`. Don't have an AdMob app?
Create one for free in the [AdMob console](https://apps.admob.com/), or use
Google's public test IDs while developing — see the [`example`](example)
app for both platforms' values.

### React Native

```sh
npm install @react-native-ads/ump react-native-nitro-modules
cd ios && pod install
```

### Expo

```sh
npx expo install @react-native-ads/ump react-native-nitro-modules
npx expo prebuild
```

### Required native setup

The UMP SDK refuses to run without a Google-issued AdMob App ID, even if you
don't use AdMob/Google Mobile Ads — omitting this throws
`The UMP SDK requires a valid application ID`.

Android — add to `android/app/src/main/AndroidManifest.xml`:

```xml
Expand All @@ -50,11 +44,34 @@ iOS — add to `Info.plist`:
<string>YOUR_ADMOB_APP_ID</string>
```

Don't have an AdMob app? Create one for free in the
[AdMob console](https://apps.admob.com/) to get an App ID, or use Google's
public test IDs while developing (`ca-app-pub-3940256099942544~3347511713`
on Android, `ca-app-pub-3940256099942544~1458002511` on iOS — see the
[`example`](example) app).
### Expo

```sh
npx expo install @react-native-ads/ump react-native-nitro-modules
```

Enable the bundled config plugin — it wires up the App ID on both platforms
for you:

```json
{
"expo": {
"plugins": [
[
"@react-native-ads/ump",
{
"androidAppId": "YOUR_ADMOB_APP_ID",
"iosAppId": "YOUR_ADMOB_APP_ID"
}
]
]
}
}
```

```sh
npx expo prebuild
```

## API

Expand Down
56 changes: 56 additions & 0 deletions packages/ump/app.plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
const {
AndroidConfig,
createRunOncePlugin,
withAndroidManifest,
withInfoPlist,
} = require('expo/config-plugins');
const packageJson = require('./package.json');

// The UMP SDK refuses to run without a Google-issued AdMob App ID, even if
// the app doesn't use AdMob/Google Mobile Ads — see the package README.

function withUMPAndroidAppId(config, androidAppId) {
return withAndroidManifest(config, (modConfig) => {
const mainApplication = AndroidConfig.Manifest.getMainApplicationOrThrow(
modConfig.modResults
);
AndroidConfig.Manifest.addMetaDataItemToMainApplication(
mainApplication,
'com.google.android.gms.ads.APPLICATION_ID',
androidAppId
);
return modConfig;
});
}

function withUMPIosAppId(config, iosAppId) {
return withInfoPlist(config, (modConfig) => {
modConfig.modResults.GADApplicationIdentifier = iosAppId;
return modConfig;
});
}

function withUMPAds(config, { androidAppId, iosAppId } = {}) {
if (!androidAppId || !iosAppId) {
throw new Error(
"@react-native-ads/ump config plugin requires both 'androidAppId' and " +
"'iosAppId' — the UMP SDK requires a Google-issued AdMob App ID to " +
'run. Pass them in app.json/app.config, e.g.:\n' +
'["@react-native-ads/ump", { "androidAppId": "ca-app-pub-XXXXXXXXXXXXXXXX~XXXXXXXXXX", "iosAppId": "ca-app-pub-XXXXXXXXXXXXXXXX~XXXXXXXXXX" }]'
);
}

config = withUMPAndroidAppId(config, androidAppId);
config = withUMPIosAppId(config, iosAppId);
return config;
}

const plugin = createRunOncePlugin(
withUMPAds,
packageJson.name,
packageJson.version
);

module.exports = plugin;
module.exports.default = plugin;
module.exports.withUMPAds = withUMPAds;
10 changes: 10 additions & 0 deletions packages/ump/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"types": "./lib/typescript/src/index.d.ts",
"default": "./lib/module/index.js"
},
"./app.plugin.js": "./app.plugin.js",
"./package.json": "./package.json"
},
"files": [
Expand All @@ -22,6 +23,7 @@
"nitro.json",
"*.podspec",
"react-native.config.js",
"app.plugin.js",
"!ios/build",
"!android/build",
"!android/gradle",
Expand Down Expand Up @@ -58,6 +60,7 @@
"user-messaging-platform",
"admob",
"google-mobile-ads",
"expo",
"ios",
"android"
],
Expand Down Expand Up @@ -85,16 +88,23 @@
"@babel/preset-typescript": "^7.27.1",
"@types/react": "^19.2.0",
"babel-jest": "^29.7.0",
"expo": "*",
"nitrogen": "0.29.6",
"react": "19.2.3",
"react-native": "0.85.0",
"react-native-nitro-modules": "^0.29.6"
},
"peerDependencies": {
"expo": "*",
"react": "*",
"react-native": "*",
"react-native-nitro-modules": "^0.29.6"
},
"peerDependenciesMeta": {
"expo": {
"optional": true
}
},
"workspaces": [
"example"
],
Expand Down
2 changes: 1 addition & 1 deletion packages/unity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Unity Ads — interstitial and rewarded video ads for React Native.
- 🎮 Unity Ads — interstitial and rewarded video
- ⚡️ [Nitro Modules](https://nitro.margelo.com/) — direct JSI bindings, no bridge overhead
- 📱 iOS & Android
- 🧩 Works with Expo out of the box — no config plugin needed
- 🧩 Expo CNG supported
- 🔒 Fully typed API

## Installation
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3391,14 +3391,19 @@ __metadata:
"@iabtcf/core": "npm:^1.5.6"
"@types/react": "npm:^19.2.0"
babel-jest: "npm:^29.7.0"
expo: "npm:*"
nitrogen: "npm:0.29.6"
react: "npm:19.2.3"
react-native: "npm:0.85.0"
react-native-nitro-modules: "npm:^0.29.6"
peerDependencies:
expo: "*"
react: "*"
react-native: "*"
react-native-nitro-modules: ^0.29.6
peerDependenciesMeta:
expo:
optional: true
languageName: unknown
linkType: soft

Expand Down
Loading