Custom Intent for Camera (video and file upload)

Hi all,

I’m trying to configure a custom intent (android app 3.4.1) to integrate video recording with a capture program. But I’n not sure if i am missing something about how camera integrations work to capture files and upload.

The documentation mentioned about camera applications among the intended integrations for custom intents, but also looking at the configuration options:

  • data vlue types: only TEXT and LONG_TEXT are supported
  • response types: String / Integer / Float / Boolean / JSON Object / List of JSON Objects

I first tested with the camera app (android.media.action.VIDEO_CAPTURE) on a TEXT elemen. The camera opens and records normally, but the field shows “Couldn’t retrieve data.”

  • Is there a request parameter I should be sending (an output URI, or something equivalent) that I’ve missed?
  • Or the “camera applications” in the docs meant to be apps that return like a barcode read rather than image or video files?

(Difference use for upload files is that we use microscope to capture video then upload, it’s actually a custom video app…but i tested with mobile camera first; this is also to streamline the files per TEA without mixing the files for different person)

Thanks a lot in advance.

Hi @kateshih

Welcome back to the community! :slight_smile:

You’ve correctly identified that custom intents only support TEXT or LONG_TEXT metadata types. (source)

Perhaps your custom app could upload the file via the /api/fileResources? Also, if your uploads are going to increase and be stored for a while, storing media files such as videos might be quite heavy so how about uploading them to a separate file storage service and retrieving the URL in the DHIS2 metadata?

I hope these suggestions help. If you would like to create a feature request for custom intents to support file metadata, please feel free to, see ideas !

Looking forward to from you what would work best for your use-case/implementation.

Hi @kateshih,

As Gassim mentioned, the Custom Intent implementation does not support images or videos at the moment.

The only workaround at the moment is to create a FILE dataElement and record the video in a separate process, which maybe is something you have already tried. This process is not very streamlined because it involves two steps and might introduce wrong assignments for the videos:

  1. Record the video using the camera app.
  2. Fill in the form and select the recorded video in the file picker.

That said, I think that adding support for videos would be a great improvement for the Custom Intent feature.

@vgarciabnz @Gassim

Thanks for confirming. Using the File data type is the workaround we’re using.

On the wrong-assignment risk, that’s our very concern actually.
I have created a feature request and looking forwart to any furture updates!
https://dhis2.atlassian.net/jira/polaris/projects/ROADMAP/ideas/view/3513029?selectedIssue=ROADMAP-669&atlOrigin=eyJpIjoiMGNkODlhNWQxZjZkNGYxN2FlYWVhNjk1Y2ZlODM1NTAiLCJwIjoiaiJ9

Thanks a lot!