Skip to main content

Android

On Android the iframe communicates with the host application through an injected JavaScript object called legitHealthJsObject. Use WebViewCompat.postWebMessage to wire it up.

Reference implementation​

A complete working example is published here:

github.com/Legit-Health/android-iframe-integration

Permissions​

The host application must grant permission for the camera and the file selector so they are displayed correctly inside the WebView.

Listen for messages​

The iframe posts every message as a JSON string through legitHealthJsObject. Decode the string and dispatch on the message field; the catalogue is identical to the web one (see the Callbacks section).

Camera workaround​

Frameworks such as Ionic block the standard <input type="file"> flow on Android. If you embed the iframe in such a framework, enable the alternative camera module on Android with enableAlternativeCameraModuleAndroid=1 (see the Customize page).

Next Steps​

  • Understand each callback type? See the Callbacks section.
  • Ready to retrieve the report? See the Output β†’ API Endpoint page.
  • Want to display the results? See the Output β†’ User Interface page.