# BlueStack SDK - React Native

## Introduction
**React Native BlueStack SDK** allows you to monetize your app with BlueStack; It's a wrapper that provides functionality to integrate native BlueStack SDK into React Native project for both iOS and Android.

The module supports three types of Ads:

1. Component based Banner Ads.
2. Full screen Interstitial Ads.
3. Full screen Rewarded Ads.

## Prerequisites

-   **React Native 0.80 or higher**
    -   Supports React Native New Architecture (Fabric/TurboModules)
-   **Node.js 18 or higher**
-   **TypeScript support** (project is written in TypeScript)
-   **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 14.0 or higher (for React Native 0.80+ support)
    -   CocoaPods for dependency management

## Setting up environment

To work with this project, you'll need to set up your development environment with the necessary tools and dependencies. Here’s a comprehensive list of the prerequisites:

### 1. Node.js and npm (or Yarn)

-   **Node.js**: JavaScript runtime built on Chrome's V8 JavaScript engine.
-   **npm**: Node package manager, which comes with Node.js.
-   **Yarn** (optional): Alternative package manager.

You can download and install Node.js from [nodejs.org](https://nodejs.org/).

To verify the installation:

```bash
node -v
npm -v
```

To install Yarn (optional):

```bash
npm install -g yarn
```

### 2. Watchman (macOS Only)

Watchman is a tool by Facebook for watching changes in the filesystem. It's highly recommended on macOS to improve performance.

```bash
brew install watchman
```

### 3. React Native CLI

React Native CLI is the command-line interface for React Native. Install it globally using npm or Yarn:

```bash
npm install -g @react-native-community/cli
```

or

```bash
yarn global add @react-native-community/cli
```

### 4. TypeScript

This project is written in TypeScript. While TypeScript will be installed as a dependency when you install the SDK, you may want to install it globally for better development experience:

```bash
npm install -g typescript
```

or

```bash
yarn global add typescript
```

To verify the installation:

```bash
tsc --version
```

### 5. Java Development Kit (JDK)

For Android development, you'll need Java Development Kit (JDK) 17 or higher. You can install it from:

-   [Oracle JDK](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
-   [OpenJDK](https://adoptium.net/) (recommended)
-   [Amazon Corretto](https://aws.amazon.com/corretto/)

To verify the installation:

```bash
javac -version
java -version
```

Make sure both commands show version 17 or higher.

### 6. Android Studio

Android Studio provides the Android SDK and other necessary tools for Android development.

1. Download and install [Android Studio](https://developer.android.com/studio).
2. During installation, ensure you install the following components:

    - Android SDK
    - Android SDK Platform
    - Android Virtual Device (AVD)

3. Configure the environment variables:

```bash
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
```

### 7. Xcode (macOS Only)

For iOS development, you need Xcode 14.0 or higher for React Native 0.80+ support.

1. Download and install [Xcode](https://apps.apple.com/us/app/xcode/id497799835?mt=12) from the Mac App Store.
2. Install Xcode Command Line Tools:

```bash
xcode-select --install
```

3. Open Xcode and install any additional required components.

### 8. CocoaPods (iOS Only)

CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. It's used in React Native for handling native iOS dependencies.

Install CocoaPods using Ruby gem:

```bash
sudo gem install cocoapods
```

## Setting Up the React Native Bluestack module

Once you have all the prerequisites installed, you can set up the Bluestack module in your React Native project:

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

## Usage

-   [SDK Integration](https://developers.bluestack.app/react-native/)
-   [Displaying Ads](https://developers.bluestack.app/react-native/ad-formats/)
