What is the User-Agent Header Used in Medic APK?

Hello everyone,

I’m currently working with unbranded Medic Collect apk from playstore, and I’m trying to determine the User-Agent header it uses when making HTTP requests. Understanding this would help with logging, filtering, or troubleshooting network traffic related to the app.

Does anyone have insights into what the default User-Agent string looks like for Medic Collect? Alternatively, is there a way to configure or override it?

Any guidance, including where to find this in the source code or how to capture it from network traffic, would be greatly appreciated!

Thanks in advance!

Probably the first question here is what you actually mean by “Medic Collect”. :sweat_smile: There is a very old SMS-based app called medic-collect, but I do not believe this is available from the Play Store. I expect this is not what you mean.

The Android app that we recommend using for any current/future deployments is cht-android. You can check out the app source code in the linked repo, but you will notice that the Android app is mostly just a webview wrapper around the normal CHT webapp coming from cht-core.

As an alternative to manually trying to sniff the User-Agent from network traffic, on CHT versions >=4.7.0, you can actually use the /api/v2/export/user-devices endpoint to get a bunch of data about the users’ devices. This data is extracted from the actual User-Agent used the last time the user connected to the server. If you want to see the raw User-Agent value collected for the user’s device, you can manually review the telemetry docs stored in the medic-users-meta DB in Couch and check the device.userAgent field.

Assuming the APK in question here is latest CHT Android, it looks like the User Agent is subjective to the device.

Here’s a quick test I did:

  1. set up an instance of docker helper
  2. download the latest “Medic Mobile” unbranded the Unbranded App in the Play Store
  3. follow docker logs docker logs $(docker ps -q --filter="Name=nginx-1") --follow
  4. when prompted in the APK, enter the docker helper URL

This results in an User Agent that has my phone model (Pixel 5) among other things:

Mozilla/5.0 (Linux; Android 15; Pixel 5 Build/AP4A.250205.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/132.0.6834.122 Mobile Safari/537.36 org.medicmobile.webapp.mobile/v1.5.0

This because there’s a relationship between the APK and the Webview APK that is installed, so the User Agent is a combination of your phone + CHT Android + Webview APK.

1 Like