I've trouble to exec a java method by the following.
I use the Browser.executeJavaScript from Construct2... As Function name i said: startGame();
In Android Studio I created a Class like:
public class GameEventsPlugin extends CordovaPlugin {
private Context context;
override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
this.context = cordova.getActivity().getApplicationContext();
super.initialize(cordova, webView);
}
override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
if (action.equals("startGame")) {
Toast.makeText(this.context, "App gestartet", Toast.LENGTH_LONG).show();
}
return true;
}
}
In my activfity class I put this before loadUrl(launchUrl):
pluginEntries.add(new PluginEntry("QM-Plugins", new GameEventsPlugin()));
The initialize method is called, but never the execute... What is wrong?