Audio recording
Audio recording captures the participant's microphone input for the whole session and uploads it alongside the rest of the session data. Use it to hear what participants say during a session, for example spoken feedback, think-aloud studies, or conversations with an in-app assistant.
Note
This feature is disabled by default for privacy reasons. To enable it for your organization, contact us through the Intercom chat
and share your intended use case.
Note
This feature is supported in the Cognitive3D Android SDK version 1.3.0 and above, on Android, Android XR, and Meta Spatial SDK.
Once audio recording is enabled for your organization, turning it on in your app takes two changes: a setting in cognitive3d.json and a permission in your app manifest.
Enable audio recording
1. Turn on the setting
Set enable_audio_recording to true in your app's cognitive3d.json:
{
"enable_audio_recording": true
}
2. Declare the microphone permission
Add RECORD_AUDIO to your app's AndroidManifest.xml:
<uses-permission android:name="android.permission.RECORD_AUDIO" />
The SDK does not declare RECORD_AUDIO itself, so apps that don't use audio recording never gain microphone access by including the SDK. Android can only request permissions that your app declares, so this line is required. Without it, the SDK records the session without audio and logs a warning (see Troubleshooting).
Permission prompt
By default, the SDK requests RECORD_AUDIO when your first activity resumes, in the same dialog as its other optional permissions. You don't need to write any permission code.
If the participant denies the permission, the session continues without audio.
Request the permission yourself
To control when the prompt appears, for example after your own consent or onboarding screen, set request_audio_permission to false. The SDK then never prompts for the microphone:
{
"enable_audio_recording": true,
"request_audio_permission": false
}
Request the permission from your activity when you are ready:
if (checkSelfPermission(Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
requestPermissions(arrayOf(Manifest.permission.RECORD_AUDIO), RECORD_AUDIO_REQUEST_CODE)
}
if (checkSelfPermission(Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[] { Manifest.permission.RECORD_AUDIO }, RECORD_AUDIO_REQUEST_CODE);
}
The SDK checks the permission every time the session starts or resumes. Closing the permission dialog resumes your activity, so recording starts as soon as the participant grants the permission. Audio before that point is not recorded.
Configuration options
| Setting | Default | Description |
|---|---|---|
enable_audio_recording |
false |
Records the participant's microphone during the session. Requires RECORD_AUDIO in your app manifest. |
request_audio_permission |
true |
When false, the SDK never prompts for the microphone and your app requests it instead. |
How recording works
- The SDK records mono AAC audio at 22.05 kHz and 32 kbps, and uploads it in 10-second chunks.
- Recording pauses when your app goes to the background and resumes when it returns.
- When the device is offline, the SDK stores audio chunks in the local data cache and uploads them later. If the cache is full, recording pauses until there is room again.
- The
c3d.device.audio_tracking.enabledsession property reports whether audio was recorded for the session.
Troubleshooting
Enable enable_logging in cognitive3d.json and filter Logcat by the Cognitive3D tag.
No permission prompt, and no microphone permission in the app settings. Your app manifest doesn't declare RECORD_AUDIO. The SDK logs:
enable_audio_recording is set but the app manifest does not declare RECORD_AUDIO
Add the permission from step 2 and reinstall your app.
The participant denied the permission. The SDK logs Audio recording enabled but RECORD_AUDIO not granted once per session. Android may not show the dialog again after repeated denials. The participant can grant the permission in the system settings for your app, and recording starts on the next resume.
Recording starts successfully. The SDK logs Audio recording started, followed by uploads to the /v0/audio endpoint.
See also
- Custom session properties: add your own properties alongside
c3d.device.audio_tracking.enabled. - Custom events: log the moments that give context to what participants say.
If you have a question or any feedback about our documentation please use the Intercom button (purple circle) in the lower right corner of any web page or join our Discord.