Skip to content

Android SDK

Behavioral analytics for your Android app, in minutes.

A lightweight Kotlin SDK that captures every event and session, tracks FCM & HMS push, and works offline — streaming it all into B2Metric IQ for funnels, retention and churn.

From zero to first event in three steps

Add the Gradle dependency, initialize in your Application class, and log your first event.

  • Install

    Add the dependency with Gradle

  • Initialize

    Initialize in your Application class

  • Track

    Log a typed event in one call

Everything you need to understand mobile behavior

One install captures the full picture — automatic baselines plus precise, typed events you control.

  • Track Events

    Capture how users interact with your app.

    Log custom events with a single call and attach a property map — strings, numbers, booleans — for full context on every interaction.

  • Automatic Event Tracking

    Lifecycle events, with zero code from you.

    The SDK automatically tracks key lifecycle events — app opens, sessions and activity transitions — so you get a behavioral baseline out of the box.

  • Push Notification Tracking

    Measure delivery and engagement.

    Built-in support for Firebase Cloud Messaging and Huawei Mobile Services attributes notification delivery and opens to downstream behavior.

  • Event Batching & Flushing

    Battery- and network-friendly by design.

    Events are queued and sent in batches to optimize battery life and network usage. Tune batchSize and flushInterval to fit your app.

  • Offline Support

    Never lose an event off-grid.

    Events captured while the device is offline are persisted locally and flushed automatically once connectivity returns.

  • Debug Mode

    Verify your integration in real time.

    Raise the log level to stream every event and network call to Logcat while developing, then silence it for release builds.

Tuned for development. Hardened for production.

Three parameters control everything. Send events instantly while debugging, then batch for battery and network efficiency in release builds.

  • apiKey · String · required — Your B2Metric API key. Must be non-empty.
  • batchSize · Int · default 20 — Number of events to batch before sending.
  • flushInterval · Long · default 30 — Time in seconds between automatic flushes.

Rich context, attached automatically

  • Call logEvent with a name and typed properties — the SDK enriches every payload before it leaves the device.
  • Each event carries a unique id and ISO timestamp.
  • Your properties map passes through with full type fidelity.
  • user_properties — device, OS, app version, locale — are added for you.

The full Android SDK reference

From installation to troubleshooting — every page in the B2Metric Academy Android guide.

  1. 01Introduction
  2. 02Installation
  3. 03Track Events
  4. 04Automatic Event Tracking
  5. 05Push Notification Tracking
  6. 06Event Batching & Flushing
  7. 07Debug Mode
  8. 08Best Practices
  9. 09Troubleshooting
  10. 10API Reference
  11. 11Support & Release History

Ship your first insight today.

Add the package, paste your API key, and watch events arrive in B2Metric IQ in real time.