More and more I see entire products built on this ability which is pretty simple really .

How can we connect a responsive and dynamic UI such as Html5 that is able to migrate easily between devices with the Java ability of controlling the device under Android OS ? 

The idea is to :

  1. Set the promise and enabling usage of javascript interface in Java
  2. Create the corresponding implementation for the javascript interface in Java 
  3. Call the Java class and functionality from javascript – letting you control the device with the whole power of Java drivers from html5 – JQuery UI .

How to recipe :

  • in :   

private DefMemoryReleaser  dmr ;


   dmr = new DefMemoryReleaser(this, appView);

   appView.addJavascriptInterface(dmr, “JavaDefMemoryReleaser”);


  •  buildjava corresponding class DefMemoryReleaser

package com.EggedDefinition;

import org.apache.cordova.DroidGap;

import android.webkit.WebView;

public class DefMemoryReleaser {

         private WebView mAppView;

         private DroidGap mGap;

          public DefMemoryReleaser(DroidGap gap, WebView view)


           mAppView = view;

           mGap = gap;


         public void freeMemory(){







  • in javascript : 

if (typeof (window.JavaDefMemoryReleaser) != ‘undefined’)



Now you are ready and set to build and sell security products for Android – Godspeed !  🙂