How I can create simple application same as ODK but not reading forms from server

Hi everyone,
Hope you are all doing well,

I'm trying to develop an android mobile application that can submit two or three textual answers, one GPS point and one image file to an OpenRosa compliant server(Ona.io personal account), exactly how ODK does.

Actually it's like ODK but not going to read any xls form from any server, the form/questionnaire structure should be coded inside the app and use forever. But, it certainly sends the data to a server like ODK does. It's a volunteer project which I'm going to launch.

Specific questions;

  • How should I create the questionnaire inside the application(no need to get from server)?
  • How should I generate the xml file from the entered data and store to odk directory?
  • How should I send the xml + media/instances to my Ona.io account(I know I've to have a form uploaded there and make that form inside the android app. but how should I send?)
  • Shall I save the data into SQLite database or xml will work out?
  • Do I need to send data from SQLite database or just send the xml+media/instances from odk directory from sd card?
  • Will the server accept only xml data or it accepts the other type of data like json as well?

Your help would be much appreciated :slight_smile:

Best regards,
Amin Sherzad

Hi @sheramin

I think you could just put your xml forms into assets and then copy them to /odk/form/ dir one the app is started for the first time. Please check out how we do that in our espresso tests

1 Like

Thanks for the replay @Grzesiek2010. Will check it out and get back if I had any question :slight_smile:

Hi @Grzesiek2010,
Thanks for the good solution, It looks very smart. But, I could not find out in which file you did the copy action/script. I mean coping xml form from assets into odk/form/ dir. If you mention the specif file name it would be much appreciated :slight_smile:
The links you left above, redirects me to a directory containing many files :frowning:

Thanks in advance!
Amin

We copy forms using methods from this class https://github.com/opendatakit/collect/blob/master/collect_app/src/androidTest/java/org/odk/collect/android/test/FormLoadingUtils.java

2 Likes

@Grzesiek2010
Thank you so much man! Although, I've already did that in another way which is a bit shorter I think. anyway, many thanks for your great product and continuous help!

1 Like