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 artifactio.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,
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.
java.time and other APIs that need
core library desugaring below API 26. If your minSdk is under 26, turn it on:
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 yourApplication:
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.
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).
setAttribute is added to every record from then on; null removes it.
Logs, errors and breadcrumbs
- Log levels are
TRACE,DEBUG,INFO,WARN,ERRORandFATAL. Logs below the minimum level of the remote configuration (Info by default) are dropped on the device. recordErrorrecords a handled error with its stack. Errors are grouped into issues like crashes;fingerprintreplaces the default grouping. See Crashes and issues.- Breadcrumbs are the steps shown before a crash or an error in the same session.
Spans
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
traceparentheader goes only tofirstPartyHostsand 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.
HttpURLConnectionis 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:Feature flags
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.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_SECUREare 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 withdrawBehindor aCanvas) 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, callApsio.replayMask(view), Apsio.replayUnmask(view) or Apsio.replayHide(view)
(in Kotlin also view.apsioReplayMask() and the others). In Compose, use the modifiers:
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_moderecord listing them.
Check what is recorded
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 R8 mapping of each release build: Upload R8 mappings;
- the native libraries with their debug information: Upload NDK symbols.
APSIO_TOKEN
or from apsio login; never put it in a build script.
Privacy and consent
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
batteryoff. - Device or other IDs: the installation id, unless you turn
installationIdoff. - 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.
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: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: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
pointerInputalone has no semantics, and a view group that draws digits indispatchDrawover its own children looks like a container: mark such keypads withapsioReplayMask()orapsioReplayHide(), or give their keysclickablesemantics. - 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
HttpURLConnectionare not recorded.
Next
- Upload R8 mappings, so crashes show your classes and lines.
- Remote configuration: sampling and capture without a release.