Initiate a form download directly on ODK Collect from an external app

Is there a way to communicate to ODK collect to download a specific form directly through an intent from an external app?

Hi @Kigamba

it's not possible using just ODK Collect but you can share forms using Bluetooth for example and paste recived forms to /odk/forms dir.

Thanks, I will check on this

Could we add an intent for downloading the ODK form using ODK collect from an external app so that ODK collect still handles the authentication, validation, form version management, downloading attachments & the javarosa specification?

Seems like a reasonable idea to me! File an issue at https://github.com/opendatakit/collect and send in PR against it.

Thanks @yanokwa. I will do that

1 Like

A possible approach might be to get the ODK Collect app to 'register' itself for a custom URL (eg "collect://..."), where the '...' would be, say, the formid. When (auto) launched - from your external app - with such a URL, ODK Collect could extract the formid from the incoming URL, download the desired form if necessary, and initiate the requested survey/form. Could this work?

1 Like

Yes this could work.

At this point I just need the form downloaded for offline use.

In a case where the user of the external app is planning surveys & is going through a list of surveys each with it's own metadata and requirements. S/he wants to download some of these surveys for offline use later thus only download would be required at this point.

As for the custom URL, why would you prefer a custom URL to an simple android intent at this point?

'cause iOS intents are incredibly primitive compared with Android's... :wink:
No reason - yer right, an Android intent is probably a more obvious solution here, and would give you the added expressibility to say "please install this form" vs "please load and start up this form".

Here is the implementation https://github.com/opendatakit/collect/pull/2348

1 Like