Installation
Ask AI about this page
@qartvelo/react-native-ads brings Qartvelo Ads banner, interstitial and rewarded ads to React Native apps on Android and iOS. It is a thin bridge: campaign selection, timeouts, AdMob fallback, request de-duplication and the reward-once guarantee all run in the native Android SDK and iOS SDK. The JavaScript layer validates arguments, returns typed results and forwards events.
- New Architecture only: a TurboModule (
NativeQartveloAds) and a Fabric component (QartveloAdsBannerView), generated by codegen and autolinked. - Android and iOS are supported. On web every promise rejects with
unsupported_platform,<QartveloAdsBanner />renders nothing andQartveloAds.isSupported()returnsfalse, so shared code runs everywhere.
Requirements
Section titled “Requirements”| React Native | 0.79 or newer with the New Architecture enabled (newArchEnabled=true, the default) |
| iOS | React Native minimum deployment target (15.1 for RN 0.79; newer RN releases may require more) |
| Android | minSdk 24, compileSdk 35 or newer |
| Build JDK | 17 |
| Expo | Bare workflow or a development build (expo prebuild); not Expo Go |
Built and tested with React Native 0.87 (React 19.2); the native code only uses React Native APIs available since 0.79.
1. Install the package
Section titled “1. Install the package”npm install @qartvelo/react-native-ads# or: yarn add @qartvelo/react-native-adsiOS setup (0.4.1+)
Section titled “iOS setup (0.4.1+)”cd iospod installcd ..npx react-native run-iosThe package includes the native Swift SDK and privacy manifest. CocoaPods automatically links
RNQartveloAds. No additional SPM package, CocoaPods trunk publication or credentials are required.
Avoid linking a second copy of QartveloAds into the same application target.
2. Native SDK repository (Android)
Section titled “2. Native SDK repository (Android)”The plugin depends on the native SDK com.qartvelo.ads:core:0.6.1, published on Maven Central. React Native and Expo projects already list mavenCentral(), so there is nothing to add. (Pinning a version before 0.3.4 with QartveloAds_sdkVersion needs JitPack: maven { url "https://jitpack.io" } in allprojects.repositories. To try an SDK build from ./gradlew publishToMavenLocal in android/, set QartveloAds_useMavenLocal=true in android/gradle.properties and add mavenLocal() to allprojects.repositories.)
3. AdMob fallback (optional)
Section titled “3. AdMob fallback (optional)”When Qartvelo Ads has no ad, the SDK can show an ad from your own AdMob account. Configure it in one
place; the App IDs (with ~) come from your AdMob apps.
Add the plugin to app.json and run npx expo prebuild (or build with EAS):
{ "expo": { "plugins": [ [ "@qartvelo/react-native-ads", { "admob": { "androidAppId": "ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy", "iosAppId": "ca-app-pub-xxxxxxxxxxxxxxxx~zzzzzzzzzz", "delayAppMeasurementInit": true } } ] ] }}The plugin turns on the native adapter on both platforms, writes the App IDs to AndroidManifest.xml
and Info.plist, and adds Google’s recommended SKAdNetwork identifiers (skAdNetworkItems adds
more). An invalid App ID stops the prebuild with a message naming the key.
Bare React Native
Section titled “Bare React Native”Put the same object under a top-level key in your app’s app.json:
{ "name": "MyApp", "@qartvelo/react-native-ads": { "admob": { "androidAppId": "ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy", "iosAppId": "ca-app-pub-xxxxxxxxxxxxxxxx~zzzzzzzzzz" } }}Then run pod install and rebuild. The Android build adds the adapter and the App ID; on iOS the
podspec adds the adapter and a build phase writes the App ID and SKAdNetwork list into the built
Info.plist on every build. The phase is a short script that finds the installed package at build
time (through NODE_BINARY from ios/.xcode.env), so the Xcode project you commit holds no path of
your machine.
Test units and ad unit ids
Section titled “Test units and ad unit ids”In development, debuggable Android builds use Google’s test units for the fallback
(admobTestUnitsInDebugBuilds, default true); every iOS install outside the App Store does too.
AdMob ad unit ids differ per platform: pass them to admobAdUnits as { android, ios } values
(Usage).
Legacy setup (0.4.x)
Section titled “Legacy setup (0.4.x)”QartveloAds_admobEnabled=true in android/gradle.properties and
ENV['QARTVELO_ADS_ADMOB_ENABLED'] = 'true' in the Podfile still work, with the App IDs set in your
own AndroidManifest.xml and Info.plist.
4. Rebuild
Section titled “4. Rebuild”The TurboModule and banner component are compiled into the app, so rebuild after installing or upgrading:
npx react-native run-androidA JavaScript reload is not enough: calls reject with module_unavailable until the native app is rebuilt.
Local backend over HTTP (debug only)
Section titled “Local backend over HTTP (debug only)”For a local backend at http://10.0.2.2:8000/, allow cleartext in debug builds:
<network-security-config> <domain-config cleartextTrafficPermitted="true"> <domain includeSubdomains="false">10.0.2.2</domain> <domain includeSubdomains="false">localhost</domain> </domain-config></network-security-config><manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> <application android:networkSecurityConfig="@xml/network_security_config" tools:ignore="UnusedAttribute" /></manifest>localhost keeps Metro working on physical devices through adb reverse tcp:8081 tcp:8081.
Next: Usage.