We have plugins that register for a secure element element in Android.

>From the plugin.xml file:

        <config-file target="AndroidManifest.xml"
parent="/manifest/application">
          <activity
            
android:name="de.dtag.tlabs.wallet.handler.UiccTransactionEventHandlerActivity"
            android:finishOnTaskLaunch="true"
            android:launchMode="singleInstance"
            android:noHistory="true"
            android:theme="@android:style/Theme.NoTitleBar" >
            <intent-filter>
                <action
android:name="android.nfc.action.TRANSACTION_DETECTED" />
                <category android:name="android.intent.category.DEFAULT" />

                <data
                    android:host="secure"
                    android:path="/a00000000102"
                    android:port="0"
                    android:scheme="nfc" />
           </intent-filter>
          </activity>
        </config-file>

The activity then starts the main cordova application (with or without
newintent depending whether main is already running or not) and the plugin
fires a javascript event to the main application using sendJavascript.

  static final String javaScriptEventTemplate = "var e =
document.createEvent(''Event'');\n"
      + "e.initEvent(''{0}'');\n" + "e.tag = {1};\n" +
"document.dispatchEvent(e);";

  private void fireTagEvent(final String eventName, final String value) {
    final CordovaWebView webView = this.webView;
    cordova.getActivity().runOnUiThread(new Runnable() {
      @Override
      public void run() {
        String command = MessageFormat.format(javaScriptEventTemplate,
eventName, value);
        Log.v(TAG, "Executing java script command: ");
        Log.v(TAG, command);
        webView.sendJavascript(command);
      }
    });
  }



I do not know how I would do this with PluginResult...


The main application has a addEventListener in it's javascript that catches
the javascript event fired from the native plugin.
How would I do this without sendJavascript?

-Axel



2014-05-26 20:58 GMT+02:00 Joe Bowser <[email protected]>:

> On Mon, May 26, 2014 at 11:53 AM, Jesse <[email protected]> wrote:
> > Is the webview method evaluateJavascript [1] still available, callable
> from
> > the context of a plugin? Or is this somehow hidden?
>
> It only exists on KitKat, earlier implementations require
> loadURL(javascript://).
>
> >
> > Personally I think is okay to remove the cordova implemented
> > sendJavascript() as long as there is still a way to accomplish the rare
> but
> > sometimes required bare metal pass through.
> >
> > Do/will other pluggable webviews support a consistent interface for
> calling
> > javascript in their loaded pages? ie. Does crosswalk support
> > evaluateJavascript?
> >
> Very good question! I don't know.
>

Reply via email to