HAPI now has a specially built binary (JAR) which can be used on Android. Android developers may use this JAR to take advantage of the FHIR model classes, and the FHIR client (running a FHIR server on Android is not yet supported. Help wanted!)

The Android JAR ships as a "shade JAR", meaning it is a single JAR containing all of the dependencies required in order to use HAPI FHIR. You should not need to include any other libraries.

Note that the Android JAR is still new and hasn't received as much testing as other parts of the library. We would greatly appreciate feedback, testing, etc. Also note that because mobile apps run on less powerful hardware compared to desktop and server applications, it is all the more important to keep a single instance of the FhirContext around for good performance, since this object is expensive to create. We are hoping to improve performance of the creation of this object in a future release. If you are an Android developer and would like to help with this, please get in touch!

Get the Android JAR

To add the HAPI library via Gradle, use the following dependency. Note the following things:

  • The classifier should be set to the version of FHIR you want to support.
  • You need to excluded a few things in order to get this to work. This is a quirk because the way HAPI is built and will hopefully be resolved in a future release.
dependencies {
	compile "ca.uhn.hapi.fhir:hapi-fhir-android:2.2:dstu2@jar"
}

You may also download a copy from the GitHub Releases page.

Performance

On mobile devices, performance problems are particularly noticeable. This is made worse by the fact that some Android devices have much slower performance than modern desktop computers. See the Client Configuration Performance page for some tips on how to improve client performance.

Examples

The following is intended to be a selection of publicly available open source Android applications which use HAPI FHIR and might be useful as a reference.

If you know of others, please let us know!

Back to top

Reflow Maven skin by Andrius Velykis.