Concepts of the SDKs

An SDK is the library an app embeds to send reports to the Heardfix back office. This page holds what the SDKs share, and says so when a section applies to one SDK only. Each SDK guide only covers its own code.

The app and its key

OwnWeb creates your app in your organization. Its page, under Heardfix, Apps, shows:

The endpoint

The endpoint is the address of the back office. The SDKs send to the back office hosted by OwnWeb by default: the initialisation on the app page only gives an endpoint on a back office of your own. The SDK sends each report to {endpoint}/api/heardfix/v1/reports. The request is described in the API contract.

Authentication: Firebase App Check

The back office only accepts a report from a mobile app that proves it comes from your app, through Firebase App Check: Play Integrity on Android, App Attest or DeviceCheck on iOS. A mobile app without Firebase uses the key only method instead. A website authenticates by its allowed origins and a proof of work instead, see the web module.

The SDK has no authentication logic. Your app gives it a callback that returns a fresh App Check token, called before each upload, and the SDK sends it as X-Firebase-AppCheck.

  1. In the Firebase console, add your iOS and Android apps to a Firebase project, then register them in App Check: Play Integrity for Android, App Attest for iOS.
  2. Copy the Firebase project number from the project settings (the number, not the project id). An admin of your organization enters it on the app page, field "Firebase project number". The back office only accepts tokens issued for this project.
  3. Activate App Check in the app before initialising the SDK, as the SDK guide shows.

Develop against the back office

There is one back office: the one your users send to. To send reports from a simulator or a debug build, use the App Check debug provider:

  1. Activate the debug provider in debug builds only. Release builds keep Play Integrity and App Attest.
  2. Run the app once. The Firebase SDK prints a debug token in the console (on iOS, add -FIRDebugEnabled to the launch arguments of the Xcode scheme).
  3. In the Firebase console, App Check, Apps, "Manage debug tokens", add this token.

Reports from this simulator are now accepted. A debug token lets anyone pass App Check: keep it out of the repository, and delete it from the Firebase console once it is no longer used.

Authentication: key only

A mobile app without Firebase sends its key alone, as Sentry does with its DSN. An admin of your organization enables the key_only method on the app page, and the app passes no App Check token: the initialisation on the app page has none.

The key ships inside the app, so anyone who extracts it can send reports in your app's name, from a script or a forged app. The back office contains it rather than prevents it:

Choose App Check when your app already has Firebase: it proves each report comes from your genuine app.

Kinds

A report is a bug report (bug, the user reports a problem) or a suggestion (feature, the user suggests an improvement). Give the user two entries, one per kind. A triager may change the kind once the report is received. Terms are defined in the glossary.

What a report carries

The table describes a report of the Flutter SDK. The web module sends the page address, the browser and the window size instead of the battery, memory and storage, and the JavaScript errors of the page instead of the log and the Sentry ids: see the web module.

Part Content
Typed by the user Title, description, email (optional, prefilled by the app when the user is signed in), up to 3 images
Context App version and build, platform, OS version, device model, locale, installation id, battery, free and total memory and storage, install, update and start dates
Diagnostics The last log lines, the caught errors, the ids of the Sentry events of the session, the "crashed on previous run" flag

Every field and its limits are listed in the API contract. Every SDK shows the user what it sends before they send it.

The content of a report is health data: it stays in the back office, which needs an HDS certified host to store health data. Never log personal or health data: no email, no name, no measurement, no text typed by the user. See data protection.

Offline and retries

The web module keeps no queue: it sends the report once and tells the visitor when it fails. In the Flutter SDK, a report is stored on the device as soon as the user sends it, then uploaded. The answer of the back office decides what happens next:

Back office answer What the SDK does
201, 200 Removes the report: it is received. 200 means it was already received with the same id
401, 403 Keeps it, retries later: the authentication token may refresh
429 Keeps it, retries after the Retry-After delay. Drops it when the delay outlasts the 7 days a report stays queued
402 Drops it, writes a warning to the technical log: the organization is on the Free plan and reached its reception ceiling
5xx, network error Keeps it, retries with a growing delay
404, 413, 422, any other 4xx Drops it, writes a warning to the technical log

The report id is sent as Idempotency-Key: a report sent twice after a lost answer is stored once.

Limits