Using the CommCare support library

(Andres Colubri) #1

Hello there,

I am working on an app that displays supportive care guidelines for febrile viral diseases, tailored by a severity score computed from patient data using prognostic models.

Right now, I wrote my own custom data entry functionality, which the app uses to create the risk and guidelines visualization, but I think the app would be more useful if could integrate its visualization modules with a CommCare-based data entry app.

I started looking at this guide on integrating Android apps with CommCare, and eventually found my way to the CommCare support library, which sounds like it may be what I need, although the examples on the GitHub repo are scant. I also did some search on the confluence site for additional documentation on this library, but did not find much.

My plan would be to create a simple CommCare data collection app for febrile diseases, and then having that app interfacing with the visualization app I wrote earlier. Do you think this is feasible? Do you happen to have any examples on how to use the support library to get data from a CommCare app that I could adapt for my own project?

Thank you!

(Clayton Sims) #2

Hi Andres!

The use case you are articulating is definitely supported by CommCare, and there are a couple examples floating around of apps which use the on-device API’s (Intent callouts, content providers, etc) to use CommCare as a backbone for data entry and management and then use a different app on device for more domain-specific functionality.

We have only recently begun rolling that functionality into the Support Library, so the guidance from that library may be quite limited.

You may find it helpful to check out the commcare-android repository wiki which has a few different examples of these API’s, and/or the tester app (not sure what state this is in) which goes through some of the pre-support library examples of using content providers and intent callouts.

The support library is mostly just a rough wrapper around those API’s,

The two that are probably of most interest to you are the

page and the

The second one will allow you to “jump in” to CommCare from an external application and control the data session.

If you have particular questions I can walk you through a few different ways to use the libraries. If you want to wrap any new API usages into the Support Library, it might give you an easy hook and baseline. We’re happy to review pull requests and additions!


(Andres Colubri) #3

Hi Clayton,

Thanks a lot for your reply! I’m now going through the resources you pointed to, and will post an update as soon as I make some progress or get stuck along the way :slight_smile:


(Andres Colubri) #4

Ok, looks like I’m figuring it out… The tester-app (which uses the support library) is providing to be very useful!

At this moment, my workflow is like this: user selects “enter data” in the visualization app, and then is presented with a dialog asking to create a new case, or lookup an existing case using CommCare. I will keep you posted on how this goes.

(Andres Colubri) #5

Actually, things worked out pretty nicely. I’m now able to get case data from CommCare into my app, either by launching the CommCare app to create a new case, or by looking up existing cases. I filed a couple of issues in the support library:

Thanks for your help!