expo-config-plugin-appodeal
v1.0.9
Published
Expo Config Plugin to automate Appodeal setup in Expo-managed apps
Maintainers
Readme
expo-config-plugin-appodeal
A TypeScript-based Expo Config Plugin that automates the native setup for the Appodeal ads SDK in Expo‑managed apps (SDK 48+). This plugin saves you from manually editing Podfiles, Gradle files, and Info.plist. Just install the plugin, configure your app.json, and EAS Build does the rest!
✨ What This Plugin Does
Android:
- Adds the
maven { url "https://artifactory.appodeal.com/appodeal" }repo toandroid/build.gradle. - Appends the Appodeal core SDK dependency (
implementation 'com.appodeal.ads:sdk:X.Y.Z') inandroid/app/build.gradle.
- Adds the
iOS:
- Modifies the Podfile to include
pod 'Appodeal'withuse_frameworks!. - Sets
NSAllowsArbitraryLoadsin Info.plist to ensure ads can load over HTTP.
- Modifies the Podfile to include
Extra (When
fullSetup: true):- Adds the AdMob adapter line for iOS + Android.
- Adds a sample SKAdNetwork identifier to Info.plist (for demonstration).
Configuration:
- Allows you to provide an Appodeal Key (
appKey) via plugin options or environment (EXPO_PUBLIC_APPODEAL_KEY). - Exposes your key at runtime via
config.extra.appodealKey.
- Allows you to provide an Appodeal Key (
One‑Step Integration:
- No more manual
PodfileorGradleedits – everything happens automatically duringexpo prebuildor EAS Build.
- No more manual
📦 Installation
Install the plugin and the
react-native-appodeallibrary:npm install expo-config-plugin-appodeal react-native-appodeal
Or with yarn:
yarn add expo-config-plugin-appodeal react-native-appodealConfigure in your
app.jsonorapp.config.js.
For a simpleapp.json, add:{ "expo": { "plugins": [ [ "expo-config-plugin-appodeal", { // Appodeal key inline (optional if using ENV var) "appKey": "YOUR_APPODEAL_APP_KEY", // Optional: override default Pod & Gradle SDK versions "iosSdkVersion": "3.5.2", "androidSdkVersion": "3.5.2.0", // If true, adds AdMob adapter lines + example SKAdNetwork "fullSetup": true } ] ], "extra": { "appodealKey": "YOUR_APPODEAL_APP_KEY" } } }Prebuild or Build your project:
# Generate native files (no-install prevents auto pod install): expo prebuild --no-install # (Optional) Install iOS pods manually: cd ios && pod install && cd .. # Finally, do a dev or production build: eas build --platform ios eas build --platform android
🏗 Usage in Your Code
After the plugin injects the native SDK, you can call Appodeal from JavaScript/TypeScript:
import React, { useEffect } from 'react';
import { View, Button } from 'react-native';
import Appodeal, { AppodealAdType } from 'react-native-appodeal';
export default function App() {
useEffect(() => {
// Initialize the SDK with your key
Appodeal.initialize(
'YOUR_APPODEAL_KEY',
AppodealAdType.BANNER | AppodealAdType.INTERSTITIAL | AppodealAdType.REWARDED_VIDEO
);
}, []);
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Button
title="Show Interstitial"
onPress={() => Appodeal.show(AppodealAdType.INTERSTITIAL)}
/>
</View>
);
}If you prefer using environment variables, you can access process.env.EXPO_PUBLIC_APPODEAL_KEY or Constants.expoConfig?.extra?.appodealKey.
⚙️ Advanced Topics
Additional Adapters: If you need more adapters (Facebook, Unity, etc.), you must either set
fullSetupto true or manually add them to your Podfile/Gradle. This plugin only demonstrates AdMob in “fullSetup” mode.SKAdNetwork: Real-world usage often requires you to add many SKAdNetwork IDs. In “fullSetup” mode, we just insert an example. You can modify
plugin.tsto add the entire list.NSUserTrackingUsageDescription: For iOS 14+ IDFA. You should set it in your config or use a separate plugin (e.g. expo-tracking-transparency).
iOS Adapters: If you want more ad networks than the built-in core, you must add network adapter pods (e.g.,
APDGoogleAdMobAdapter). You can do this manually by editing your Podfile or by using expo-build-properties to inject extra pods.Android Adapters: The Gradle artifact
com.appodeal.ads:sdk:3.5.0.0often includes multiple networks, but you’ll still need to define network-specific IDs inAndroidManifest.xmlif the network requires them (for example, AdMob’s App ID).
💡 Common Questions
Q: Why do I only see “no fill” or no ads on iOS?
A: You may need to add each network’s adapter or set test mode. Also, the iOS simulator typically doesn’t serve real ads, so test on a device. By default, pod 'Appodeal' only installs core. You might need to add specific adapter pods for each ad network you intend to use. See Appodeal’s iOS docs for the list of adapter pods.
Q: Do I still need to call Appodeal.initialize()?
A: Yes! The plugin only sets up the native build. You still handle initialization in your JavaScript.
Q: Will it conflict with the official react-native-appodeal instructions?
A: It replaces the manual Podfile/Gradle edits from those instructions. You still need react-native-appodeal installed for the JavaScript APIs, but you do not need to manually edit your Podfile or Gradle files—this plugin handles that.
🛠 Maintaining This Plugin
If you cloned or forked this repo to maintain the plugin, here’s how to develop and publish:
Install dependencies:
npm installBuild the plugin code (TypeScript → JS):
npm run buildThis outputs compiled files to the
build/folder.Test locally (optional):
npm link # Then in a test Expo app: npm link expo-config-plugin-appodeal # Add plugin to app.json and run expo prebuild/eas buildPublish changes:
npm login npm publish --access publicThat’s it—the plugin is live on npm!
How to Publish to npm
Commit all your changes and bump the version in package.json (e.g. 1.0.4 → 1.0.5).
Build your plugin code:
npm run buildLog in to npm if you haven’t already:
npm loginPublish:
npm publish --access public
Your plugin is now updated on npm. Users can install with:
npm install expo-config-plugin-appodeal💰 You Can Help Me by Donating
License
MIT License – free to use, modify, and distribute.
