Skip to content
midgeDocs
ShareAndroid app SDK
Share

Android app SDK

Let people report a bug from inside your own Android app: the app's screen, its network requests, its logs and your metadata, redacted on the phone.

MidgeSDK for Android is in early access. Email [email protected] to try it in your app.

MidgeSDK is the website SDK for native Android apps, and the counterpart of the iPhone app SDK. Someone using your app shakes the phone, or taps your own Report a bug button, records the screen and says what went wrong. The report reaches your workspace with what the app did in that time: its HTTP requests and responses, its log lines and the context you set, such as the user’s ID or plan.

Everything is redacted on the phone before it’s sent, by the same code as the Chrome extension: passwords, tokens, cookies, card numbers and your workspace’s own hidden names never leave it.

Set it up

  1. Make a recording link. Open Settings › Workspace › Recording links on midge.dev and create one. Reports from the app go to it.
  2. Register your app. In the App SDK card, an owner or admin adds the app’s application id, such as com.example.shop. MidgeSDK sends only from apps registered there; for any other app, the report sheet says so and sends nothing.
  3. Add the library. MidgeSDK for Android is in early access: email [email protected] with your app’s name, and we’ll give you access to the library (Android 8.0, API 26, or later). Then start it in your Application with your link’s token, the part after /record/:
kotlin
import dev.midge.sdk.Midge

class ShopApp : Application() {
    override fun onCreate() {
        super.onCreate()
        Midge.start(this, link = "rl_YOUR_TOKEN")
    }
}

Shaking the phone now opens the report sheet. To open it from your own button instead, or as well:

kotlin
reportButton.setOnClickListener { Midge.report() }

What’s captured

  • Network: requests made through an OkHttpClient with Midge’s interceptor, with their headers, text bodies (up to 64 KB), status and timing. Retrofit, Coil and Ktor’s OkHttp engine use an OkHttpClient, so one line covers them:
kotlin
val http = OkHttpClient.Builder()
    .addInterceptor(Midge.okHttpInterceptor())
    .build()
  • HttpURLConnection and Volley: open connections through Midge and they’re recorded the same way; the connection works exactly as before.
kotlin
val connection = Midge.openConnection(URL("https://api.example.com/cart"))   // instead of url.openConnection()

// Volley
Volley.newRequestQueue(context, object : HurlStack() {
    override fun createConnection(url: URL) = Midge.openConnection(url)
})
  • Any other client (Cronet, Ktor’s own engines, gRPC): report a request when its response arrives.
kotlin
Midge.network("POST", url, status = 500, durationMs = 412, responseBody = body)
  • Logs: your app’s own logcat lines (Log.i, Log.e, Timber, println) from the time of the recording, read when the report is sent. An app may read its own log without any permission; Android’s framework lines are left out. Midge.log("…", Midge.Level.ERROR) adds a line of your own.
  • Device: the app’s name, version and build, the phone’s maker and model, Android version, screen size, language and time zone.
  • Metadata: whatever you set with Midge.metadata, the latest value:
kotlin
Midge.metadata(mapOf("userId" to user.id, "plan" to "pro", "flags" to mapOf("newCheckout" to true)))
Midge.user(name = user.name, email = user.email)   // fills the sheet's name and email

Requests from the last five minutes are kept in memory only, and nothing is sent unless the person taps Send.

Options

kotlin
Midge.start(this, link = "rl_YOUR_TOKEN", options = Midge.Options().apply {
    shakeToReport = false   // only your button opens it
    captureNetwork = false
    captureLogs = false
})

What the person sees

A sheet explains what will be recorded. Record the screen shows Android’s own screen-sharing prompt, then a small red Stop pill with a timer stays at the top of your app while they use it; the notification has a Stop button too. Afterwards they watch the recording, describe what happened, optionally add a name and email, and tap Send. Back hides the sheet without losing the recording; the next shake or button brings it back.

Google Play

Recording the screen runs as a foreground service of type mediaProjection, which the library declares in its manifest. When you publish, Play Console asks you to declare that foreground service type: describe it as “records the screen when the user reports a bug, only after they tap Record and allow it.”

What you get

The report appears in your workspace like any recording from a link, marked as sent from an SDK, with the app’s name. Its network requests and console line up with the video, and the AI summary, Slack, Linear, Jira, GitHub and webhooks work as usual.

Limits

The recording link limits apply. A workspace can register up to 20 apps. Redaction runs in Android’s JavaScript sandbox, which needs an up-to-date Android System WebView; on a phone without it, the report is sent without its logs rather than unredacted.