Skip to content

shobhitagarwal1612/collectTester

 
 

Repository files navigation

ODK Collect Intents Tester

This app is intended to be used for testing ODK Collect app and presenting how to open activities of ODK Collect directly from an external app.

ODK Collect offers us to open a bunch of it's activities from another app. You can open a specific form or one of existed lists (list of empty forms, saved forms, finalized forms, sent forms).

Thanks to that you can build your own app that interact with ODK Collect through intents.

Alt Text

Example

If you want to start ODK Collect's activity you need to:

  1. Create a new intent using an appropriate action.
  2. Set the typ of created intent.
  3. Start an activity using the intent.

The code should looks like below (in this case it's the Form Chooser list):

    public void startFormChooserList(View view) {
        Intent i = new Intent(Intent.ACTION_VIEW);
        i.setType(FORMS_CHOOSER_INTENT_TYPE);
        startActivityIfAvailable(i);
    }

where

FORMS_CHOOSER_INTENT_TYPE = "vnd.android.cursor.dir/vnd.odk.form";

You can find all the other examples in MainActivity or ListActivity.

Note

On the other side you can also open other apps from ODK Collect, for example in order to read a value - see the ODK Counter.

License

Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.html

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%