Get Started
This documentation will guide you through the steps to integrate and initialize the BlueStack React Native Plugin into your application.
BlueStack SDK React Native Plugin provides functionalities for monetizing your mobile application: from premium sales with rich media, video and innovative formats, it facilitates all standard display formats. BlueStack SDK React Native Plugin can be used for both iOS and Android apps.
Looking for a working reference? Our public demo app on GitHub — azerion/azerion-inapp-demo-reactnative — showcases banner, interstitial, rewarded, MREC, native, overlay, and app-open ads against the public test App ID 3167505.
Prerequisites
- Use React Native 0.80 or higher
- Android
- Target Android API level 21 or higher
- Java Development Kit (JDK) 17 or higher
- Android Build Tools 35.0.0 or compatible
- AndroidX support
- iOS
- iOS 13.0 or higher
- Xcode 15.1 or higher
Configure your app
Installation
Install the BlueStack React Native Plugin from npm:
npm install @azerion/bluestack-sdk-react-native
Import components
import {
BluestackSDK,
BannerAdView,
BannerAdType,
InterstitialAdManager,
RewardedAdManager,
} from "@azerion/bluestack-sdk-react-native";
To include targeting options, import the following components:
import {
AdPreference,
ProviderType,
GenderType,
LocationType,
} from "@azerion/bluestack-sdk-react-native";
Add mediation partners
Mediation adapters are added as native dependencies on each platform. We recommend including all adapters by default so the SDK can serve from every available demand source — omit an adapter only if you have a specific reason not to ship it.
Recommended default: include every mediation adapter. The snippets below add the full bundle for each platform.
- Android
- iOS
Add the repositories and adapter dependencies to your app-level build.gradle:
repositories {
google()
mavenCentral()
maven { url 'https://packagecloud.io/smartadserver/android/maven2' }
}
dependencies {
...
implementation 'com.azerion:bluestack-mediation-bidding:6.0.0.1'
implementation 'com.azerion:bluestack-mediation-google:6.0.0.1'
implementation 'com.azerion:bluestack-mediation-equativ:6.0.0.2'
...
}
For Google Mobile Ads, also add your AdMob App ID to AndroidManifest.xml:
<manifest>
<application>
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
</application>
</manifest>
Add the adapter pods to your app's Podfile:
pod 'BlueStackBiddingAdapter'
pod 'BlueStackGoogleAdapter'
pod 'BlueStackEquativAdapter'
pod 'BlueStack-SDK', :subspecs => ["BluestackAmazonPublisherServicesAdapter"]
For Google Mobile Ads, also add the GADApplicationIdentifier key to your Info.plist with the ID provided by your Azerion Publisher Representative.
For per-partner setup, Swift Package Manager, ProGuard rules, and the compatibility matrix, see Android Supported Networks and iOS Supported Networks.
Initialize the BlueStack SDK
Before loading any ads, initialize the BlueStack SDK by calling BluestackSDK.initialize() with the appId parameter. You can optionally pass a second enableDebug parameter (defaults to false) to enable debug logs.
You have to register your app in the BlueStack console to get an App Id for your app.
Here's an example of how to initialize the SDK:
BluestackSDK.initialize(appId, true)
.then(() => {
console.log("BluestackSdk initialized");
})
.catch((e) => {
console.log("BluestackSdk failed to initialize: " + e);
});
Here's an example of how to check the SDK initialization status (bluestack-sdk-react-native >= 1.2.0):
const isInitialized = BluestackSDK.isInitialized();
console.log("SDK is initialized:", isInitialized);
Note: If the BlueStack SDK fails to initialize, the initialize promise will be rejected with the corresponding error.