Closed aroth closed 8 years ago
You can get the message like CordovaActivity.java
/**
* Called when a message is sent to plugin.
*
* @param id The message id
* @param data The message data
* @return Object or null
*/
public Object onMessage(String id, Object data) {
if ("onReceivedError".equals(id)) {
JSONObject d = (JSONObject) data;
try {
this.onReceivedError(d.getInt("errorCode"), d.getString("description"), d.getString("url"));
} catch (JSONException e) {
e.printStackTrace();
}
} else if ("exit".equals(id)) {
finish();
}
return null;
}
That worked -- thank you.
Is it possible to override onReceivedLoadError in MainActivity#onCreate? With the cordova crosswalk plugin, onReceivedLoadError is defined in XWalkCordovaResourceClient, but I'd like to define my own functionality without having to edit that file.
I had something that almost worked ---- but my custom Cordova plugins were no longer called. I suspect I was overriding an existing hook incorrectly:
Any thoughts?