fmtm
fmtm copied to clipboard
Enable ODK Collect to launch a specific form with a specific preselected entity, from an Intent
A possible plan:
-
Change the Android Manifest to permit a web browser to deep-link into
FormFillingActivity
. -
Change
FormLoaderTask
to accept a URI that specifies the form by its XForm ID (e.g.trowein_new_kru_town_v2_224_buildings
, not by its local ID (e.g. "forms/2"). The local ID will not be known to FMTM because it depends on what forms are loaded on the phone, so we'll need a way for FMTM to specify the form by its XForm ID. -
In
FormLoaderTask
, add a method to prefill the entity based on query parameters in the URI (e.g.preselectEntity(FormEntryController fec, Uri uri)
). It should look for a query parameter in the URI (e.g.?entity=...
) and callFormEntryController.answerQuestion
to fill in the entity question with aSelectOneData
answer, based on the entity UUID provided as the query parameter. -
At the end of
FormLoaderTask.doInBackground
, callpreselectEntity
. -
In FMTM, get hold of the form's global UUID.
-
Populate the ODK Central server with the entities corresponding to the buildings to be mapped.
-
In FMTM, deep link to the ODK Collect app using the selected building's entity UUID.
(Or, as an alternative to Step 3, construct an instance XML data structure that contains the prefilled answer.)
Example of FormIndex pointing to the first question (the entity selection question):
Example of the data in the answer to the first question (after an entity is selected):