Skip to main content

Getting Started

This section explains how to get started with BlueStack React Native Plugin. It guides you through the process of adding the BlueStack React Native Plugin to your project.

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 Ios and Android Apps.

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 12.2 or higher
    • Xcode 14.0 or higher (for React Native 0.80+ support)

1. Plugin Integration

Installation

npm install @azerion/bluestack-sdk-react-native

Import components

import {
BluestackSDK,
BannerAdView,
BannerAdType,
InterstitialAdManager,
RewardedAdManager,
} from "@azerion/bluestack-sdk-react-native";

To include Preferences, import following components

import {
AdPreference,
ProviderType,
GenderType,
LocationType,
} from "@azerion/bluestack-sdk-react-native";

2. SDK Implementation

Initializing the SDK

You need to initialize SDK using the initialize method with the appId (App Id) parameter, before you request any kind of ads. You can also set the 2nd parameter (optional) enableDebug to true, if you want to enable debug option. By default enableDebug is false.

info

You have to register your app in 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);