Skip to content

Test mode in your app

Your app’s test app has its own key (app_test_…), contacts and data (Test mode); your team sets it up with Set up test mode on Testing › Test mode. Nothing in your code changes for it: a staging build sends the test app’s key, against the same address.

What you draw: nothing, unless you want a mark of your own on a staging build (see below).

Give each build type its key, for example with a product flavour or a build type:

app/build.gradle.kts
android {
buildTypes {
getByName("debug") {
buildConfigField("String", "CRM_APP_KEY", "\"app_test_...\"") // staging
}
getByName("release") {
buildConfigField("String", "CRM_APP_KEY", "\"app_...\"") // what your users install
}
}
}
CrmConfig(
apiBase = "https://app.purrcrm.com",
appKey = BuildConfig.CRM_APP_KEY,
appVersion = BuildConfig.VERSION_NAME,
)

Find both keys in the App key card on Settings › your app › Developers › Install: switch Live | Test in the app switcher to see the test app’s.

The test app checks tokens with its own sign-in. Your staging backend signs with the test app’s identity secret (crm_is_test_…, on Settings › your app › Developers › Sign-in in Test). A staging token sent with the live key, or a live token with the test key, is refused with a sentence saying which. The SDK writes it to the log once, and does not keep asking for new tokens.

Pushes go through the test app’s own Firebase key (your staging Firebase project), to the devices your staging build registered. Use a separate Firebase app (its own google-services.json, under src/debug/) for a staging build with its own applicationId. Emails go only to addresses on the test app’s allow-list; the rest wait in the Test outbox.

Links have their own link domain in the test app too: add your staging build’s package and signing fingerprints on Links › Setup in Test, and its host to the staging build’s intent filter (Links).

  • crm.isTestMode says whether the build talks to the test app: from the app’s public face once PurrCRM has answered, and from the key’s prefix until then. isTestAppKey(key) reads a key’s prefix alone.
  • The SDK has no ribbon of its own (the Flutter SDK’s CrmTestModeBanner). To mark a staging build, draw one yourself when crm.isTestMode is true and BuildConfig.DEBUG.
  • A release build with a test key writes a warning to the log (Logcat, tag crm) once as it starts, and carries on: a staging key in what your users install would put all of them in the test app. The setup check’s App key and mode row shows the mode, and turns amber for a test key in a release build.