Skip to main content
API preview: names may change before 1.0.

Requirements

  • Android 7.0 (API level 24) or later.
  • Kotlin 2.2 or later, or Java. The SDK is compiled as Kotlin 2.2, so apps on React Native 0.87 can use it too.

Install

The SDK is the artifact io.apsio:apsio-android, with io.apsio:apsio-compose for Jetpack Compose replay and the Gradle plugin io.apsio.gradle for symbols, all version 0.1.0. Apsio’s public Maven repository, https://maven.apsio.io, is not live yet. Until it is, publish them from a checkout of the repository at v0.1.0 to your local Maven repository,
and add mavenLocal() to the repositories in your settings.gradle.kts, in both pluginManagement and dependencyResolutionManagement. Once the repository is live, maven { url = uri("https://maven.apsio.io") } takes its place.
The SDK is built on opentelemetry-android, which uses java.time and other APIs that need core library desugaring below API 26. If your minSdk is under 26, turn it on:
and add android.useFullClasspathForDexingTransform=true to gradle.properties. The SDK ships its own R8 rules: a minified app needs no rules for the SDK itself.

Start

Start Apsio as early as possible, in your Application:
Calling start again does nothing. The app key is not a secret: it ships inside your app and only routes data to your project. Every call is safe from any thread and never throws; disk and network work runs on the SDK’s own threads. The SDK runs in the app’s main process only. A process the system starts without UI (a broadcast, a job) starts its session at its first foreground; until then only errors, crashes and ANRs are kept.

What is recorded

From then on Apsio records, with nothing else to do:
  • crashes: JVM crashes, and native crashes from Android 12, sent when the app next launches;
  • ANRs while the app runs, and how the last run ended on Android 11 and later (an ANR, low memory, a signal), from the system’s exit records;
  • app start time (cold, warm and hot), and a screen load time for every activity;
  • slow and frozen frames per screen;
  • breadcrumbs for screens and app lifecycle changes;
  • sessions.
Network requests are recorded once you add the OkHttp integration (Network).

Options

Users and attributes

Identify the user with a hash you compute. Never pass an email or a name. Keep it to 16 to 256 letters, digits and + / = _ . : - (a hex digest fits): that is the value you can erase the user by (Erasing a user). Requests for one user’s devices and live testers match a user by hash only from 16 characters (The user hash).
An attribute set with setAttribute is added to every record from then on; null removes it.
Attribute values are strings, booleans, integers, doubles or lists of strings.

Logs, errors and breadcrumbs

  • Log levels are TRACE, DEBUG, INFO, WARN, ERROR and FATAL. Logs below the minimum level of the remote configuration (Info by default) are dropped on the device.
  • recordError records a handled error with its stack. Errors are grouped into issues like crashes; fingerprint replaces the default grouping. See Crashes and issues.
  • Breadcrumbs are the steps shown before a crash or an error in the same session.

Spans

Spans started while another is open on the same thread become its children.

Network

Add one line to your OkHttp client (OkHttp 4.12 or 5):
  • Call it last, after your own eventListener: your listener is kept and receives every event.
  • Each request is a span with its method, URL without the query string, status, error type and body sizes, child of the span open on the calling thread.
  • A traceparent header goes only to firstPartyHosts and their subdomains, checked on every redirect, and never while consent is withdrawn. Give host names (api.example.com), without a scheme, port, path or *. prefix.
  • Request bodies and query strings are never recorded, and a failure in Apsio never fails a request. HttpURLConnection is not instrumented.

Screens

Activities are tracked on their own, named after their class. To give an activity a name that stays the same if the class is renamed (or minified), annotate it:
In Compose or with your own navigation, name screens yourself, and report when a screen shows its real content to measure its time to full display:

Feature flags

The flag and its variant are attached to the session and to crashes. In the console, filter sessions and issues by a flag and variant, and see on an issue which variants’ sessions hit it most (By feature flag); agents get the same through get_issue_flags and the flag filters.

Replay

Replay records a wireframe of the screen, never pixels: view kinds, positions, styles, state and touches, sent in segments of up to a minute, at most 5 minutes per session (2 on Free; see how much is recorded). It is off until you turn it on, and only kept sessions are recorded; the remote configuration can lower that share, or turn replay off, without a release.
For Jetpack Compose, add implementation("io.apsio:apsio-compose:0.1.0"): replay then reads Compose content from its semantics, with the same rules as views.

What is masked

Masking happens on the device, as the screen is read, and fails closed:
  • All text is masked by default: every character becomes x; spaces and line breaks stay.
  • Password, card and one-time-code fields are always masked; no setting shows them.
  • Images are boxes, and so is a view showing a bitmap or a vector drawable. Web views, maps, video, camera previews and windows with FLAG_SECURE are hidden boxes.
  • A view replay cannot read is a hidden box: a view of your app or a library that draws its own content (onDraw, draw, dispatchDraw, or a drawable of its own), and a text, button or input subclass that draws on its own. A view group that only clips or reorders its children is read as a container; one that draws itself under its children masks what is inside it. A clickable Compose element with no text and no children (drawn with drawBehind or a Canvas) is a hidden box too.
  • Touches are recorded only over what is shown: never over masked text (a PIN pad of plain buttons included), a secure field, the keyboard or a hidden box.

Your settings

Per view, call Apsio.replayMask(view), Apsio.replayUnmask(view) or Apsio.replayHide(view) (in Kotlin also view.apsioReplayMask() and the others). In Compose, use the modifiers:
You can also put the tokens apsio-mask, apsio-unmask or apsio-hide in a view’s tag, a Compose test tag or a React Native testID. A token counts only as a whole word: a word is a run of letters, digits and hyphens, so row apsio-mask, checkout.apsio-hide and card_number_apsio-mask carry a setting, and apsio-unmasked-total does not. Nothing inside a hidden view is recorded. A view’s own setting beats its class’s, and within one level hide beats mask, which beats unmask. The remote configuration can only add masking: its classes win over every setting of the app.

Class names and R8

Class settings, yours (maskClasses, hideClasses) and the remote configuration’s, match classes by their name at run time. R8 renames classes in a minified app, so:
  • Keep the name of every class you or your remote configuration name, with a rule in your app’s R8 configuration: -keepnames class com.example.checkout.CardView. Or pass the class itself, replay.hideClass(CardView::class.java), which needs no rule.
  • The SDK already keeps the names of the platform, AndroidX, Material and React Native classes it recognizes.
  • A hide or mask name that matches no class of the app, whether a typo or a renamed class, fails closed: the session is recorded in strict mode, with all text masked and images and views that draw themselves hidden. Logcat shows a warning naming the classes, and the session gets an apsio.replay.strict_mode record listing them.

Check what is recorded

The preview overlays the app’s windows with what replay records: red where it masks, grey where it hides, and a green outline where touches are recorded. It works whether or not the session records replay, and draws nothing unless the app is debuggable. The capture runs only after something changed (a touch, a draw, a new screen), at most twice a second. Reading the screen is its only work on the main thread, and it slows down when that takes more than 4 ms.

Symbols

Release builds are minified, and native code has its symbols stripped. Upload what Apsio needs to show your crashes’ classes, functions and lines: The Gradle plugin does both on every minified build, with the apsio CLI:
It writes a build id into the manifest of each minified variant, which the SDK reports with every crash, and uploads that build’s mapping with the same id. A build that uploads gets a new id each time; one that does not (local builds, by default) gets a stable id, so it stays incremental, but its crashes are not deobfuscated. The CLI reads the token from APSIO_TOKEN or from apsio login; never put it in a build script.
The choice is kept across launches. If your app must ask before anything is collected, call Apsio.setConsent(false) before or right after start, and setConsent(true) once the user agrees. While consent is withdrawn nothing is recorded, and the session during which it was withdrawn reports nothing more. See Privacy and consent. In your Play Store data safety form, declare what the SDK sends, all of it for app functionality and analytics:
  • App info and performance: crash logs, diagnostics and other app performance data, which the SDK always sends. Diagnostics include the device state, connectivity and, on a cellular connection, the carrier’s name, network codes and country, and the battery unless you turn battery off.
  • Device or other IDs: the installation id, unless you turn installationId off.
  • User IDs: if your app calls setUser, the hashed id you pass.
  • App activity, App interactions: screen views and rage and dead taps, which the SDK records by default, and, if replay is on, the screens’ structure and the taps, with text masked by default.
  • Location, Approximate location: the country and region Apsio derives on its servers from the IP address of each request.
  • With the OkHttp integration, the request URLs (without their query strings) and status codes are part of the diagnostics.
See Privacy and consent.

Live inspection

Let your team watch this device live when your project marks its user or install as an internal tester: its log lines, memory and power state, and masked wireframes of the screen. Call it from your own setting, in internal and test builds:
It is off until the app turns it on, and the SDK stores the choice when it is made, before start too, and keeps it across launches. It also needs consent and the installation id, and runs in the foreground only: it pauses when the app is interrupted for 2 s or more (an activity on screen but not resumed) and under Battery Saver or Data Saver (where it sends nothing at all), and stops in the background. It needs no permission beyond the SDK’s own. While anyone watches, each window shows “Your team is viewing this app live” at the top, inside the system bars, taking no touch, and TalkBack announces it each time it appears; a notice updates its text. Wireframes come from replay’s capturer, so they need replay on; the battery is sent unless ApsioOptions.battery is off. The SDK sets no cookies and the live host sets none, but a process-wide CookieHandler your app installs (CookieHandler.setDefault) still applies to this connection too: it sees the live host and could add its own cookies. See Live inspection for what your team sees, the commands, the limits and privacy.

Sending now

Records leave in batches. To send what is queued now, for example before a test ends:
What is left when the app moves to the background is sent by a WorkManager job when the device is online and the battery is not low; it waits as long as the server asks it to.

Known issues

  • Native crash reports need Android 12 or later. Before that, a native crash ends its session as an abnormal exit, without a stack.
  • How the last run ended (an ANR, low memory, a kill) is known from Android 11; before, only crashes are told apart.
  • Replay cannot see content drawn where neither views nor Compose semantics expose it. A Compose keypad that handles taps with pointerInput alone has no semantics, and a view group that draws digits in dispatchDraw over its own children looks like a container: mark such keypads with apsioReplayMask() or apsioReplayHide(), or give their keys clickable semantics.
  • On Android 7.0 and 7.1, the platform’s text library can split an emoji sequence into several characters: the masked text is then longer than the original, and still shows none of its characters.
  • Requests made with HttpURLConnection are not recorded.

Next