Does ODK Collect on Android Support Form Instance Autofill From External App

I've been reading the documentation, and then the source code for ODK Collect. I am working on a client's application, and they would like to be able to open ODK Collect, and while doing so, pass in data from their app into a form instance in ODK Collect.

I see the ability to edit an already existing instance, but not to create a pre-populated form. Is this the correct understanding?

Hi @LockeWatts
it's possible to open some activities of ODK Collect from an external app. For example you can open a particular form or saved instance but it's not possible to pass any data. If you want to test available functionality you can test this app: https://github.com/grzesiek2010/collectTester

1 Like

There are couple of approaches:

  • Make Collect the app users launch and launch your custom app from the form to retrieve values. See https://docs.opendatakit.org/launch-apps-from-collect/ and note that you can populate multiple fields at once.

  • Write an instance XML file directly to /sdcard/odk/instances. You can either launch the instance selection list screen which will show those new instances to the user or populate the database through the InstanceProvider. You can read more at Adding Instance to database.