Mobile Application2026

Adsterra Insights — Native Android Publisher Analytics

A native Android publisher analytics app built with Kotlin, Jetpack Compose (Material 3), Vico charts, Retrofit, and Room — connecting directly to the Adsterra Publisher API v3 with Android Keystore AES-256-GCM encrypted API key storage.

General Info

Client
Personal Project
Role
Android Developer
Status
Completed

Front-End

KotlinJetpack ComposeMaterial 3Vico Compose M3Navigation Compose

Back-End

Adsterra Publisher API v3Retrofit & OkHttpMoshiRoom DatabaseAndroid Keystore (AES-256-GCM)DataStore Preferences

Tools

Android StudioGradle (Kotlin DSL)KSPRobolectric & MockWebServerGit
Adsterra Insights multi-screen preview showing Domains, Statistics & Reports, and Placements.

Project Overview

Adsterra Insights (com.sudipmhx.adsterra) is a native Android analytics application built with Kotlin and Jetpack Compose (Material 3) that connects directly from your phone to the official Adsterra Publisher API v3 (https://api3.adsterratools.com/publisher/).

Designed for Adsterra publishers who want fast, private, on-the-go visibility into their monetization metrics, the app requires no third-party backend server. Your API token stays encrypted on your own device while delivering live KPI tracking, interactive trend charts, domain and placement breakdowns, multi-dimensional reports, and CSV exports.

Core Problem & Solution

Checking ad revenue and placement CPMs on mobile typically means logging into a desktop-heavy web dashboard repeatedly or trusting third-party wrappers with your publisher API key.

Adsterra Insights eliminates both pain points with a native, security-first client:

  • Direct Device-to-API Architecture — Communicates straight with Adsterra Publisher API v3 endpoints (domains.json, placements.json, stats.json, smartlinks.json)
  • Hardware-Backed Key Security — Encrypts your X-API-Key with Android Keystore AES-256-GCM and stores only the ciphertext and IV in DataStore Preferences
  • Fast, Structured Mobile Workflows — Dedicated bottom-navigation tabs for Dashboard, Statistics, Domains, Placements, and Settings
  • Offline-Resilient Caching & Deduplication — Room persistence paired with an in-flight RequestDeduplicator avoids redundant network calls

Key Features

🔐 Onboarding & Keystore-Encrypted API Vault

  • First-launch welcome flow with a quick sign-up link and "I Already Signed Up — Enter API Key" setup
  • Validates your X-API-Key against GET /domains.json before persisting
  • Encrypts credentials via KeystoreApiKeyManager using AES-256-GCM in the Android Keystore — zero plain SharedPreferences, zero hardcoded keys, and zero Logcat secret leakage

📊 Real-Time Publisher Dashboard

  • 7 KPI Cards — Total Revenue, Today's Revenue (UTC), Yesterday's Revenue (UTC), Total Impressions, Total Clicks, CTR, and CPM (plus eCPM when returned by the API)
  • UTC Date Presets — Today, Yesterday, Last 7 Days (default), Last 30 Days, This Month, Last Month, and Custom Date Range
  • Period Comparison Card — Tracks period-over-period percentage change when both intervals return valid data
  • Pull-to-Refresh & Auto-Refresh — Manual sync button plus configurable foreground auto-refresh intervals (Off, Every 1 min, Every 5 min, etc.)

📈 Statistics, Charts, Reports & Smartlinks

  • Interactive Charts (Vico Compose M3) — Line and column charts for Daily Revenue Trend, Impressions/Clicks/CTR performance, Domain comparison, Placement comparison, and Country (GEO) analytics
  • Custom Report Builder — Filter by Custom Dates, Domain, Placement, GEO, Sub-ID, and group_by[] dimensions with a scrollable results table
  • CSV Export & Share Sheet — Export reports as RFC-4180 CSV files and share them directly via Android FileProvider
  • Smartlinks Tab — Lists Smartlinks and one-tap Copy URL actions when supported by the publisher account

🌐 Domains & Placements Explorer

  • Domains Directory — Searchable list of publisher domains (e.g., domain ID, placement count, impressions, and revenue) with drilldown into domain-scoped placements and daily trends
  • Placements View — Search by placement name, ID, or ad format (Popunder, Smartlink, NativeBanner, SocialBar), filter by domain, and sort by Revenue, Clicks, Impressions, CPM, or Name

⚙️ Settings & Diagnostics

  • Live connection status indicator (Keystore-encrypted API key active), Test API, Sync Now, Change Key, and Disconnect
  • Configurable Auto-Refresh interval, Dark / Light / System appearance theme, Currency Display options (API Reported, USD ($), EUR (€) without assumed FX conversion), local cache clearing, and official Adsterra documentation links

In-App Preview

Overview Banners

Adsterra Insights Dashboard BannerAdsterra Insights Dashboard Banner Adsterra Insights Multi-Screen ShowcaseAdsterra Insights Multi-Screen Showcase

Mobile App Screens

All six core screens — Dashboard (Last 30 Days), Dashboard (Today & Period Comparison), Statistics & Charts, Publisher Domains, Ad Placements & CPM Breakdown, and Settings & Keystore Connection Status — arranged side by side:

Dashboard (Last 30 Days)
Dashboard (Last 30 Days)
Statistics & Charts
Statistics & Charts
Publisher Domains
Publisher Domains
Ad Placements & CPM Breakdown
Ad Placements & CPM Breakdown
Settings & Keystore Connection Status
Settings & Keystore Connection Status

Technical Architecture & Deep Dive

Clean Layered Architecture

The codebase (app/src/main/java/com/example/) is cleanly separated into three layers:

  1. Data Layer (data/)
    • AdsterraApiService & ApiClientFactory — Retrofit + OkHttp client injecting X-API-Key via AuthInterceptor, paired with ApiErrorMapper and RequestDeduplicator (ConcurrentHashMap + CompletableDeferred) to collapse duplicate in-flight API calls.
    • AdsterraDatabase & AdsterraDao — Room database caching domains, placements, and stats locally.
    • KeystoreApiKeyManager — Thread-safe (Mutex) AES-256-GCM encryption/decryption using AndroidKeyStore and DataStore<Preferences>.
  2. Domain Layer (domain/)
    • Pure Kotlin domain models, repository interfaces (AdsterraRepository), DateRangeResolver (UTC date alignment), Formatters, and CsvExporter (RFC-4180 export).
  3. UI Layer (ui/)
    • Jetpack Compose Material 3 screens (DashboardScreen, StatisticsScreen, DomainsScreen, PlacementsScreen, SettingsScreen, OnboardingScreen, ReportsTabContent, SmartlinksTabContent) driven by ViewModel state flows and Navigation Compose.

Testing Strategy

  • JVM Unit & Repository Tests (AdsterraRepositoryTest.kt) powered by MockWebServer and kotlinx-coroutines-test
  • Robolectric UI & Integration Tests (AdsterraUiRobolectricTest.kt) verifying Compose screens end-to-end without requiring an emulator (gradle :app:testDebugUnitTest)

Key Learnings

  • Implementing hardware-backed Android Keystore AES-256-GCM encryption alongside DataStore Preferences for zero-plaintext secret management
  • Building responsive, dark-mode-first financial analytics dashboards in Jetpack Compose with Vico Compose M3 charts
  • Preventing redundant API calls and rate-limit spikes via coroutine CompletableDeferred request deduplication and Room caching
  • Aligning analytics queries strictly to UTC windows to match Adsterra Publisher API v3 reporting boundaries

Challenges

Connecting directly to the Adsterra Publisher API v3 from a mobile device without a middleman server required strict client-side credential protection and resilient request orchestration. Ensuring zero plain-text key storage meant implementing Android Keystore AES-256-GCM encryption backed by DataStore Preferences, while concurrent dashboard, chart, domain, and placement refreshes needed in-flight request deduplication, Room caching, and accurate UTC date-range alignment.

What I Learned

Building Adsterra Insights deepened my expertise in modern Android architecture with Jetpack Compose and Material 3, hardware-backed encryption using Android Keystore AES-256-GCM, and interactive data visualization with Vico Compose M3. I also gained practical experience writing offline-resilient Repository layers with Room, generating RFC-4180 CSV exports via FileProvider, and testing API/UI flows with MockWebServer and Robolectric.

SudipMHX

Hey! I'm Sudip's AI Assistant. Ask me anything about my work or projects, and I'll do my best to help you out!