Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

CB-1938: Regression, Android back button event is no longer fired

  • Loading branch information...
commit 48f58110fec31a6cf8dd4e39962682d21513adaa 1 parent 7b37249
Simon MacDonald macdonst authored
Showing with 11 additions and 8 deletions.
  1. +11 −8 framework/src/org/apache/cordova/App.java
19 framework/src/org/apache/cordova/App.java
View
@@ -19,13 +19,14 @@ Licensed to the Apache Software Foundation (ASF) under one
package org.apache.cordova;
+import org.apache.cordova.api.CallbackContext;
import org.apache.cordova.api.CordovaPlugin;
import org.apache.cordova.api.LOG;
-import org.apache.cordova.api.Plugin;
import org.apache.cordova.api.PluginResult;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+
import java.util.HashMap;
/**
@@ -36,12 +37,12 @@ Licensed to the Apache Software Foundation (ASF) under one
/**
* Executes the request and returns PluginResult.
*
- * @param action The action to execute.
- * @param args JSONArry of arguments for the plugin.
- * @param callbackId The callback id used when calling back into JavaScript.
- * @return A PluginResult object with a status and message.
+ * @param action The action to execute.
+ * @param args JSONArry of arguments for the plugin.
+ * @param callbackContext The callback context from which we were invoked.
+ * @return A PluginResult object with a status and message.
*/
- public PluginResult execute(String action, JSONArray args, String callbackId) {
+ public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
PluginResult.Status status = PluginResult.Status.OK;
String result = "";
@@ -80,9 +81,11 @@ else if (action.equals("overrideBackbutton")) {
else if (action.equals("exitApp")) {
this.exitApp();
}
- return new PluginResult(status, result);
+ callbackContext.sendPluginResult(new PluginResult(status, result));
+ return true;
} catch (JSONException e) {
- return new PluginResult(PluginResult.Status.JSON_EXCEPTION);
+ callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
+ return false;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.