At a glance
-
Kotlin library, callable from Java. Package
com.jointestbuddy, version 0.3.1. - minSdk 24.
- Starts on its own from a key in your manifest: no code, the same steps for Kotlin, Java, Flutter, React Native, Expo, Unity and Capacitor.
-
One library dependency: Google's Play Install Referrer client
(
com.android.installreferrer:installreferrer:2.2). No AndroidX, no WorkManager. Like any Kotlin library, it also brings the Kotlin standard library. -
On Maven Central:
com.jointestbuddy:testbuddy-android:0.3.1, so no repository to add. -
Adds the
INTERNETpermission and one invisible activity that handles TestBuddy links. - No user interface. A tester who taps "Link it" sees a short toast; nobody else sees anything.
What it sends, and what it does not
What it sends
-
At each launch, from every phone: your app key,
your app's package name and the package name of the store that
installed the app, as Android reports it (InstallSourceInfo):
com.android.vendingfor Google Play, nothing for a build run from Android Studio or adb. This hello tells your TestBuddy dashboard that the build carries the SDK and that it was installed from Google Play, where your testers get it. - Once per install, to link it: the 6-character place code from the install referrer or the "Link it" link, with the app key and package name. TestBuddy answers with an install token, which the SDK keeps.
- After linking: sessions (when the app came to the foreground and how many seconds it stayed there, capped at 4 hours per session) and the objective keys you record. Each event carries a random event id so it is never counted twice.
What it does not collect
No name, email, advertising ID, device identifier, location, contacts, screen content or crash data. It does not see which screens are opened or what is typed. It reads the install referrer only to find a TestBuddy code in it, and the installing store only to tell a Google Play install apart.
On your real users' phones
A phone that is not linked to a tester sends the hello and nothing else. Sessions are still counted locally, because a tester's sessions before the link count too, but they stay in the app's private storage (at most 200 events) and are never sent unless that install gets linked.
Install
The SDK starts on its own when your app starts: it reads your key from
the manifest, so no step is code. Whatever your app is built with, it
comes down to the dependency, from Maven Central, and one manifest
line. Use the key shown
in TestBuddy at step 3 of the setup (later in Your app, under Setup
details); it starts with pk_. The setup shows these
steps with your key already in them.
Kotlin or Java (Android Studio)
Add the dependency: app/build.gradle.kts, in dependencies { }
implementation("com.jointestbuddy:testbuddy-android:0.3.1")
Add your key: app/src/main/AndroidManifest.xml, inside <application>
<meta-data android:name="com.jointestbuddy.KEY" android:value="pk_..." />
The key belongs to this app. Keep it in every build you upload during the test.
Flutter
Add the dependency: android/app/build.gradle.kts, at the end
dependencies {
implementation("com.jointestbuddy:testbuddy-android:0.3.1")
}
Groovy (android/app/build.gradle): implementation "com.jointestbuddy:testbuddy-android:0.3.1" in dependencies { }
Add your key: android/app/src/main/AndroidManifest.xml, inside <application>
<meta-data android:name="com.jointestbuddy.KEY" android:value="pk_..." />
The key belongs to this app. Keep it in every build you upload during the test.
React Native
Add the dependency: android/app/build.gradle, in dependencies { }
implementation("com.jointestbuddy:testbuddy-android:0.3.1")
Add your key: android/app/src/main/AndroidManifest.xml, inside <application>
<meta-data android:name="com.jointestbuddy.KEY" android:value="pk_..." />
The key belongs to this app. Keep it in every build you upload during the test.
Expo
Add the TestBuddy config plugin: plugins/withTestBuddy.js, a new file at the root of your project
// Adds the TestBuddy SDK to the Android build at each prebuild: the dependency and your key.
const { AndroidConfig, withAndroidManifest, withAppBuildGradle } = require('expo/config-plugins')
module.exports = function withTestBuddy(config, { key }) {
config = withAppBuildGradle(config, (c) => {
if (!c.modResults.contents.includes('testbuddy-android'))
c.modResults.contents = c.modResults.contents.replace(/dependencies\s*\{/, (m) => `${m}\n implementation("com.jointestbuddy:testbuddy-android:0.3.1")`)
return c
})
return withAndroidManifest(config, (c) => {
const app = AndroidConfig.Manifest.getMainApplicationOrThrow(c.modResults)
AndroidConfig.Manifest.addMetaDataItemToMainApplication(app, 'com.jointestbuddy.KEY', key)
return c
})
}
Use it with your key: app.json, in expo.plugins
["./plugins/withTestBuddy", { "key": "pk_..." }]
Build for Play: terminal
eas build --platform android --profile production
Expo Go cannot load native code; the build you upload to Play does. With a local android/ folder, run npx expo prebuild again instead.
Unity
Turn on the custom Gradle files: Project Settings, Player, Android, Publishing Settings, Build
Custom Main Manifest, Custom Main Gradle Template
Add the dependency: Assets/Plugins/Android/mainTemplate.gradle, in dependencies { }
implementation "com.jointestbuddy:testbuddy-android:0.3.1"
Add your key: Assets/Plugins/Android/AndroidManifest.xml, inside <application>
<meta-data android:name="com.jointestbuddy.KEY" android:value="pk_..." />
The key belongs to this app. Keep it in every build you upload during the test.
Capacitor or Ionic
Add the dependency: android/app/build.gradle, in dependencies { }
implementation "com.jointestbuddy:testbuddy-android:0.3.1"
Add your key: android/app/src/main/AndroidManifest.xml, inside <application>
<meta-data android:name="com.jointestbuddy.KEY" android:value="pk_..." />
The key belongs to this app. Keep it in every build you upload during the test.
Then: upload the build, install it from Google Play, open it once
Upload the build to your closed test track, install it on a phone from your closed test's opt-in link, and open it once. The SDK says hello from a Google Play install, the setup step turns verified, and you can join the next wave. A build run from Android Studio or installed with adb says hello too, but it does not count: only a Google Play install shows that testers can get your build. The closed testing setup guide covers the Play Console side.
Prefer code?
Instead of the manifest line, call TestBuddy.init once in
Application.onCreate. It is ignored if the SDK already
started from the manifest. Its optional third parameter,
apiUrl, is for local testing only.
import android.app.Application
import com.jointestbuddy.TestBuddy
class App : Application() {
override fun onCreate() {
super.onCreate()
TestBuddy.init(this, "pk_...")
}
}
Java
Every public call is @JvmStatic, so Java calls it
directly on TestBuddy:
import android.app.Application;
import com.jointestbuddy.TestBuddy;
public class App extends Application {
@Override
public void onCreate() {
super.onCreate();
TestBuddy.init(this, "pk_...");
}
}
TestBuddy.objective("first_entry");
TestBuddy.link(code);
boolean linked = TestBuddy.isLinked();
long seconds = TestBuddy.getForegroundSeconds();
The callback of link is a Kotlin function type, so from
Java it returns Unit.INSTANCE (import kotlin.Unit;):
TestBuddy.link(code, linked -> {
// Called on a background thread.
return Unit.INSTANCE;
});
Objectives
An objective is a step you want testers to reach, like saving a first entry. An app has up to 3, each with a key of lowercase letters, digits and underscores (up to 40 characters), set on your app in TestBuddy. Record one where it happens in your code:
// After the first entry is saved.
TestBuddy.objective("first_entry")
Your dashboard shows how many testers reached each objective. Keys
that are not on your app are ignored. Calling
objective before the SDK starts does nothing.
Linking an install to a tester
Automatic: the install referrer
TestBuddy gives each tester a Play Store install link for your app
with a referrer:
https://play.google.com/store/apps/details?id=<package>&referrer=tb_<code>. On the first launch, the SDK reads the referrer once through the
Play Install Referrer library, finds the tb_ code and links the install. If the
network fails, it tries again at the next launch. An install from
anywhere else carries Play's default referrer, with no code.
One tap: the testbuddy:// link
The SDK's manifest declares LinkActivity, which opens on:
testbuddy://<package>/link?code=XXXXXX
The TestBuddy web shows a "Link it" button on Android that opens this
link. The activity is translucent and kept out of recents: it links
the install, shows "Linked to TestBuddy" (or "This TestBuddy link did
not work"), then opens your app's launch activity. Without a valid
code, or in an app that never called init, it closes at
once. You add nothing to your manifest: the activity is merged from
the library, with your applicationId as the link's host.
A custom flow: TestBuddy.link(code)
If you want your own way to enter the code, call
link with the 6 letters and digits the tester sees in
TestBuddy:
TestBuddy.link(code) { linked ->
// Background thread: switch to the main thread before touching views.
runOnUiThread { showLinked(linked) }
}
linked is true once the install is linked; it is false
for an unknown code or when init was not called. Keep
such a screen out of sight, in a debug or settings menu for example: a
code prompt in your app would also show to users who are not testers,
and to Google's reviewers. That is why the SDK uses a link instead.
Checking the state
TestBuddy.isLinked is true once the install is linked.
TestBuddy.foregroundSeconds is the time since the app
last came to the foreground, 0 in the background. Both are handy on a
debug screen.
Sessions, offline queue and retries
- Sessions are counted with activity lifecycle callbacks: a session starts when the first activity starts and ends when the last one stops. The SDK queues it at that moment.
-
The queue lives in the app's SharedPreferences
(file
com.jointestbuddy) and keeps the latest 200 events. Events wait there until the install is linked and the network answers. - Sending happens in batches of 100 when the app comes to the foreground and when a session ends. A failed send is retried at the next launch or session end. There is no background job, so nothing leaves while the app stays closed.
- Late events still count: TestBuddy accepts a session up to 48 hours after it happened, and assigns it to the tester's test day in their time zone.
- Errors: a rate limit, a server error or no network keeps the events for the next try; a batch refused for good is dropped so it cannot block the queue. When a place ends, the SDK forgets its token and its queue.
Threading and safety
- Network calls and queue writes run on one background thread, so they never race and never block your main thread.
- Every task the SDK runs catches its own failures: an uncaught exception would kill your app, so the SDK swallows its errors instead of throwing them.
- Network calls time out after 10 seconds and go over HTTPS to jointestbuddy.com.
-
Calls made before
initdo nothing, andlinkreports false. - No AndroidX and no WorkManager: no version conflict with your own dependencies.
Play Data safety declaration
Closed testing tracks need a Data safety form; only apps active exclusively on internal testing are exempt. Google also states that data sent off the device by SDKs in your app counts as your app's collection, and that you alone are responsible for complete and accurate declarations (Provide information for Google Play's Data safety section).
What the SDK transmits, to help you fill it in:
- Session start times and foreground durations, and objective keys: this looks like what Play calls "App activity", "App interactions" (information about how a user interacts with the app).
- An install token that TestBuddy issues for a linked install: check whether it falls under Play's "Device or other IDs" (identifiers that relate to an individual device, browser or app).
- The app key, package name and installing store in the hello: they describe your app and where it was installed from, not the user.
- All of it is encrypted in transit (HTTPS). TestBuddy deletes session events 120 days after receiving them (privacy).
This is guidance, not legal advice. Check Play's Data safety form and its definitions for your own app, and review your answers when you remove the SDK.
Removing it
Keep the SDK in your closed test build until Google Play grants production access: the terms ask for it during your wave, and your testers' days depend on it. Once access is granted, or as soon as you stop using TestBuddy, remove it:
-
Delete the
implementation("com.jointestbuddy:testbuddy-android:0.3.1")line, or the TestBuddy plugin entry in an Expo app. -
Delete the
com.jointestbuddy.KEYmanifest line (or theTestBuddy.initline) and anyobjectiveorlinkcalls.
The link activity and the INTERNET permission go away
with the dependency, unless your app declares that permission itself.
Requirements
- Android 7.0 (API 24) or later.
- Your app described in TestBuddy, and its
pk_key. - Your app published on a closed testing track on Google Play.