Audio Recording in CHT Android Application

On our current implementation, we have noted that some mobile users (using the CHT android application) are experiencing an issue where instead of the opening the recording application (audio recording field in app forms) it opens a file upload prompt (Files app). This has been noted on multiple devices across different vendors and models.

Some devices where this issue was noted are as follows:

  • Samsung F22 (Android 11)
  • Samsung M31 (Android 10)
  • Samsung Galaxy Note 9 (Android 9)

Devices where the recording functionality working was:

  • Vivo Y53s (Android 12)
  • Realme 7 (Android 10)

Can anyone please shed some light on this matter or if let me know if there exists a valid workaround to it?

@binod @sanjay

Here’s what I found in the ODK docs about recording with an external app:

Some Android devices provide a default application for audio recording. Others do not, and the user will need to install an audio recording app.
Any app that responds to android.provider.MediaStore.Audio.Media.RECORD_SOUND_ACTION should be compatible.

I don’t have devices to test right now but the built-in recorder mentioned here might apply to ODK Collect. For CHT, it will probably rely on the external recorder any way. Is it possible that the devices you listed above where it worked had a compatible external recording app while others did not?

1 Like

That might be the case. I have those devices in hand and I will look into the default recording applications and whether they respond to the aforementioned event.

I tried using other applications said to compatible in the ODK Forums but none seem to be working. Going down the rabbit hole, and the only similar pattern being all these phones being Samsumg, I ran into a stackoverflow post mentioning an issue with the audio recording.

While this works fine on the emulator and nearly all devices it’s been tested on, when I try to run it on a Samsung Charge the Audio Recorder never gives me the option to save the recording and return to my Activity. Once the recording is complete, I’m sent to a list of all recorded audio on the device, and selecting any from this list just plays them. I can return to the calling Activity with the back button, but this causes a RESULT_CANCLED result code, no file is created at path, and the data parameter of onActivityResult is null. (data is still null if I remove the EXTRA_OUTPUT extra from the intent, nothing changes in this case)

In this case as well, the developer relented and designed their own recording GUI.

I implore @gaarimasharma to checkout the built-in recorder mentioned here

Thank you @binod sir