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

This commit is contained in:
Simon MacDonald 2012-11-27 12:18:49 -05:00
parent 7b3724972b
commit 48f58110fe

View File

@ -19,13 +19,14 @@
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 @@ public class App extends CordovaPlugin {
/**
* 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 @@ public class App extends CordovaPlugin {
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;
}
}