# ๐Ÿ“ฑ Android Ads SDK

The **Ads SDK** is a reusable Android library that allows applications to display image and video ads in a **full-screen, SDK-controlled experience**.

The SDK fully encapsulates ad fetching, selection, UI rendering, countdown logic, and lifecycle handling.

Host applications interact with the SDK through a minimal and safe public API.


## โœจ Key Features

### ๐ŸŽฌ Video Ads

- Auto-play on launch

- No pause or seek controls

- Automatically closes when playback ends

### ๐Ÿ–ผ๏ธ Image Ads

- Displayed full-screen

- Automatically closes after a fixed timeout

### โณ Ad Control \& UX

- Countdown-based close button

- SDK-managed UI (no layouts needed in the host app)

- No lifecycle handling required by the host application


## โš™๏ธ Requirements

- Android API level **24+**

- Host activity must extend ComponentActivity or AppCompatActivity

- Internet permission enabled in the host application

- Backend API compatible with the SDK schema


## ๐Ÿ“ฆ Installation

The SDK is distributed via **JitPack**.

### 1๏ธโƒฃ Add JitPack to your project

In settings.gradle.kts:


dependencyResolutionManagement {

    repositories {

        google()

        mavenCentral()

        maven { url = uri("https://jitpack.io") }

    }

}

ย 

### 2๏ธโƒฃ Add the SDK dependency


dependencies {

    implementation("com.github.TalyaBenAtar:MemoryGame:0.1.2")

}


## ๐Ÿš€ Usage

๐Ÿ”‘ Initialization

Initialize the SDK once at application startup

(recommended inside Application.onCreate()):


AdsSdk.init("https://video-ads-sdk.vercel.app")

โ–ถ๏ธ Showing an Ad

Show an ad filtered by category:


AdsSdk.showAd(this, category = "kids")

Optionally, prefer a specific ad type:


AdsSdk.showAd(

    activity = this,

    category = "kids",

    preferredType = "image" // or "video"

)

When showAd is called, the SDK will:

Fetch ads from the backend

Select a valid, enabled ad matching the filters

Launch its own full-screen ad Activity

Handle playback, countdown, and closing behavior


## ๐Ÿง  How It Works

When showAd is called, the SDK will:

The host application never interacts with ad UI or backend logic directly.

## ๐Ÿงช Demo Application

A demo application (Memory Game) is included in the SDK repository.

It demonstrates:

This app can be used during development to validate SDK behavior.


๐Ÿ“ธ SDK Screenshots

๐ŸŽฌ Video Ad Display

Video Ad


๐Ÿ–ผ๏ธ Image Ad Display

Image Ad


๐Ÿ”ง Deployment / Distribution (Optional)

Vercel Deployment

JitPack Release