Skip to main content

Overview

This document is meant for whoever is wiring the B2Metric Android SDK into an app. It covers the setup steps in the order you'll actually hit them: adding the dependency, starting the SDK, sending your first event, and then the details you'll want later, like push notification handling and how the offline queue behaves when the device loses connectivity.

If you've used an earlier version of this SDK before, note that appIdentifier and setUser are new here, so it's worth reading the Configuration and User Identification sections even if the rest looks familiar. If this is your first time integrating B2Metric on Android, the Quick Start section is enough to get an event flowing end to end, and you can come back for the rest as you need it.

The Troubleshooting section toward the end covers the issues that come up most often during integration, and the API reference is there for a quick lookup once you're past the initial setup.

The B2Metric Android SDK lets you send events to B2Metric. It provides offline-first, SQLite-backed event persistence, automatic session tracking, user identification, push notification analytics, and batched delivery with flush-level backoff. It is published to Maven Central as com.b2metric:analytics-sdk.

Setup and releases: central.sonatype.com/artifact/com.b2metric/analytics-sdk

Features​

  • Custom event tracking with properties and item-level data
  • User identification with custom attributes (setUser)
  • Automatic session management (first_open, session_start, session_end)
  • Push notification token registration (FCM, HMS) and open tracking
  • Offline-first event queuing backed by on-device SQLite storage
  • Automatic batching, retry with exponential backoff, and network-aware delivery
  • Automatic device and app metadata collection
  • Configurable log levels for debugging

Requirements​

  • Minimum Android SDK: API 24 (Android 7.0)
  • Gradle 7.0+
  • Kotlin 1.5.0+