# CrossIndie Android SDK (Kotlin)

## Concepts

- **app_id**: the id of your app, shown in the dashboard under My Apps (https://crossindie.com/dashboard/apps). It is public; it goes into your app, game or site code.
- **App API key** (`api_key`): secret, used only for the account API and the MCP server. Never put it in a shipped app, game or web page.
- **api_base**: `https://api.crossindie.com`.
- **category**: `game`, `web_tool`, `saas` or `mobile_app`. Games are shown only to games; web tools and SaaS share a pool.
- Every placed banner is an independent earning slot. An impression only counts after the banner has been visible for at least 1.5 seconds (while the window or app is focused). All credit and anti-fraud checks run on the server.
- New apps may need review before they are served. Check the app status in the dashboard.
- An app is promoted only once it is live on a store. For Google Play and App Store links the package (`play_package`) or numeric id (`appstore_id`) is derived from `target_url`; CrossIndie checks store liveness every 12 hours and shows `store_status` (live, not_found, error, unknown). Web apps do not need a store listing.

## Install

Distributed through JitPack. Add `maven("https://jitpack.io")` to the repositories in `settings.gradle(.kts)`, then add the dependency. The exact coordinates and latest version are in the README: https://github.com/Cross-Indie/sdks/tree/main/android (one artifact for Views, an optional one for Jetpack Compose).

The app needs `<uses-permission android:name="android.permission.INTERNET"/>`.

## Usage (XML / Views)

```xml
<com.crossindie.sdk.CrossIndieBannerView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:ciAppId="YOUR_APP_ID" />
```

## Usage (Jetpack Compose)

```kotlin
CrossIndieBanner(appId = "YOUR_APP_ID")
```

Check the README for the full list of attributes / parameters (category, format, callbacks) and the exact imports.

## Pitfalls

- Use category `mobile_app` for apps and `game` for games.
- The package name is sent automatically so the dashboard can confirm the SDK runs inside your store app.
- Impressions count only while the banner is at least 50% on screen with the app in the foreground for 1.5 seconds. Do not cover it.
- Clicks open the external browser and are reported once per ad.
