Android support for FMX applications


Support for browser-based applications


The technique behind running a browser-based application on Android involves adding a JavaScript interface class that acts as a communication bridge between the webbrowser client instance and the running map HTML and JavaScript. Up until API level 17 all the JavaScript interface bridge class methods and properties were accessible via JavaScript. From API level 17 this has changed to allow only the methods and properties that were decorated with the @JavaScriptInterface annotation. Unfortunately, there isn't an out of the box solution provided in the Android API/compiler available in the latest RAD Studio, so we needed to search for an alternative solution. This solution is explained in steps below and involves adding a jar file that provides a modified JavaScript interface class.

When starting an application with an instance of a browser control for Android, you will get an error indicating the JJavaScriptHelper class could not be found. The JJavaScriptHelper class is required for running your application on Android.


To fix the above error, and have your application running for Android, please follow the steps below.
  1. Navigate in your project to the Android target, open and right-click on the Libraries node.
  2. Select, "Add"

  3. Navigate to the installation directory and locate the "Android Support" folder.
  4. Select the JavaScriptHelper.jar file from the JavaScriptHelper sub folder and add it to your project.

  5. Clean, Rebuild and run your project to have your application running on Android.


Permission to access to peripherals


Some peripherals (such as camera, microphone, etc...) are accessible through the browser but to access them the user needs to grant permission first. These permissions not only need to be set at application level but at browser level too. Without an out-of-the-box solution, we applied a similar approach to JJavaScriptHelper and rely on a jar file that provides a modified interface class.

When starting an application with an instance of a browser control for Android, you will get an error indicating the JFNCWebChromeClient class could not be found. The JFNCWebChromeClient class is required for running your application on Android.


To fix this error and have your application running for Android, add the FNCWebChromeClient.jar file by following the steps above. The jar file can be found in the WebChromeClient sub folder instead of the JavaScriptHelper sub folder.

Printing support


To enable printing in your application running for Android, add the FNCPrintDocumentAdapter.jar file by following the steps above. The jar file can be found in the FNCPrintDocumentAdapter sub folder.