当前位置: 首页>>代码示例>>Java>>正文


Java CallbackContext.error方法代码示例

本文整理汇总了Java中org.apache.cordova.api.CallbackContext.error方法的典型用法代码示例。如果您正苦于以下问题:Java CallbackContext.error方法的具体用法?Java CallbackContext.error怎么用?Java CallbackContext.error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cordova.api.CallbackContext的用法示例。


在下文中一共展示了CallbackContext.error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import org.apache.cordova.api.CallbackContext; //导入方法依赖的package包/类
public boolean execute(String paramString, JSONArray paramJSONArray, CallbackContext paramCallbackContext)
  throws JSONException
{
  try
  {
    ACTION_LOG localACTION_LOG = ACTION_LOG.fromString(paramString);
    if (localACTION_LOG == null)
    {
      paramCallbackContext.error("Invalid action: " + paramString);
      return true;
    }
    localACTION_LOG.log(this.cordova.getClass().getSimpleName(), paramJSONArray.getString(0));
    paramCallbackContext.success("true");
    return true;
  }
  catch (JSONException localJSONException)
  {
    paramCallbackContext.error("Action: " + paramString + " failed. JSON Error is: " + localJSONException.getLocalizedMessage());
  }
  return true;
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:22,代码来源:Logger.java

示例2: execute

import org.apache.cordova.api.CallbackContext; //导入方法依赖的package包/类
public boolean execute(String paramString, JSONArray paramJSONArray, CallbackContext paramCallbackContext)
  throws JSONException
{
  try
  {
    if ("show".equals(paramString))
    {
      show(paramJSONArray.getString(0));
      paramCallbackContext.success("true");
      return true;
    }
    if ("hide".equals(paramString))
    {
      hide();
      paramCallbackContext.success("true");
      return true;
    }
  }
  catch (JSONException localJSONException)
  {
    paramCallbackContext.error("Action: " + paramString + " failed. JSON Error is: " + localJSONException.getLocalizedMessage());
    return true;
  }
  paramCallbackContext.error("Invalid action: " + paramString);
  return true;
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:27,代码来源:BusyIndicator.java

示例3: execute

import org.apache.cordova.api.CallbackContext; //导入方法依赖的package包/类
public boolean execute(String paramString, JSONArray paramJSONArray, CallbackContext paramCallbackContext)
  throws JSONException
{
  try
  {
    if ("show".equals(paramString))
    {
      show(paramJSONArray);
      paramCallbackContext.success(PluginResult.Status.OK.name());
      return true;
    }
    paramCallbackContext.error("Invalid action: " + paramString);
    return true;
  }
  catch (Exception localException)
  {
    WLUtils.debug("NativePage.show failed. Reason is: " + localException.getMessage(), localException);
    paramCallbackContext.error("NativePage.show failed. Reason is: " + localException.getMessage());
  }
  return true;
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:22,代码来源:NativePage.java

示例4: execute

import org.apache.cordova.api.CallbackContext; //导入方法依赖的package包/类
public boolean execute(String paramString, JSONArray paramJSONArray, CallbackContext paramCallbackContext)
  throws JSONException
{
  boolean bool = paramString.equals("getcheckcode");
  int i = 0;
  if (bool);
  try
  {
    paramCallbackContext.success(CheckCodeUtil.checkcode("", paramJSONArray.getString(0)));
    i = 1;
    return i;
  }
  catch (JSONException localJSONException)
  {
    paramCallbackContext.error("Failed to parse parameters");
  }
  return false;
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:19,代码来源:CheckCodePlugin.java

示例5: error

import org.apache.cordova.api.CallbackContext; //导入方法依赖的package包/类
/**
 * Send an error to given CallbackContext containing the error code and message.
 * 
 * @param ctx	Where to send the error.
 * @param msg	What seems to be the problem.
 * @param code	Integer value as a an error "code"
 */
private void error(CallbackContext ctx, String msg, int code)
{
	try
	{
		JSONObject result = new JSONObject();
		result.put("message", msg);
		result.put("code", code);
		
		ctx.error(result);
	}
	catch(Exception e)
	{
		Log.e(LOG_TAG, "Error with... error raising, " + e.getMessage());
	}
}
 
开发者ID:nadavelyashiv,项目名称:metal-finder-new,代码行数:23,代码来源:BluetoothPlugin.java

示例6: execute

import org.apache.cordova.api.CallbackContext; //导入方法依赖的package包/类
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
    if ("showEmailComposer".equals(action)) {

        this._callbackContext = callbackContext;

        Log.d(LOG_TAG, "Open email composer");
        try {
            JSONObject parameters = args.getJSONObject(0);
            if (parameters != null) {
                Log.d(LOG_TAG, "Call sendEmail()");
                sendEmail(parameters, callbackContext);
            }
        } catch (Exception e) {
            Log.e(LOG_TAG, "Internal Error");
            callbackContext.error("Internal Error");
            return false;
        }
    } else {
        Log.e(LOG_TAG, "Invalid Action");
        callbackContext.error("Invalid Action");
        return false;
    }
    return true;
}
 
开发者ID:giver,项目名称:cordova-android-emailcomposer-plugin,代码行数:26,代码来源:EmailComposer.java

示例7: execute

import org.apache.cordova.api.CallbackContext; //导入方法依赖的package包/类
public boolean execute(String paramString, JSONArray paramJSONArray, CallbackContext paramCallbackContext)
{
  if (paramString.equals("start"))
  {
    if (this.batteryCallbackContext != null)
    {
      paramCallbackContext.error("Battery listener already running.");
      return true;
    }
    this.batteryCallbackContext = paramCallbackContext;
    IntentFilter localIntentFilter = new IntentFilter();
    localIntentFilter.addAction("android.intent.action.BATTERY_CHANGED");
    if (this.receiver == null)
    {
      this.receiver = new BroadcastReceiver()
      {
        public void onReceive(Context paramContext, Intent paramIntent)
        {
          BatteryListener.this.updateBatteryInfo(paramIntent);
        }
      };
      this.cordova.getActivity().registerReceiver(this.receiver, localIntentFilter);
    }
    PluginResult localPluginResult = new PluginResult(PluginResult.Status.NO_RESULT);
    localPluginResult.setKeepCallback(true);
    paramCallbackContext.sendPluginResult(localPluginResult);
    return true;
  }
  if (paramString.equals("stop"))
  {
    removeBatteryListener();
    sendUpdate(new JSONObject(), false);
    this.batteryCallbackContext = null;
    paramCallbackContext.success();
    return true;
  }
  return false;
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:39,代码来源:BatteryListener.java

示例8: execute

import org.apache.cordova.api.CallbackContext; //导入方法依赖的package包/类
public boolean execute(String paramString, JSONArray paramJSONArray, CallbackContext paramCallbackContext)
  throws JSONException
{
  if ("getNetworkInfo".equals(paramString))
  {
    paramCallbackContext.success(getNetworkData(this.cordova.getActivity()));
    return true;
  }
  paramCallbackContext.error("Invalid action: " + paramString);
  return true;
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:12,代码来源:NetworkDetector.java

示例9: execute

import org.apache.cordova.api.CallbackContext; //导入方法依赖的package包/类
public boolean execute(String paramString, JSONArray paramJSONArray, CallbackContext paramCallbackContext)
  throws JSONException
{
  try
  {
    if ((!"updateApp".equals(paramString)) && (!"switchApp".equals(paramString)))
    {
      paramCallbackContext.error("Invalid action: " + paramString);
      return true;
    }
    String str1 = CookieManager.getInstance().getCookie(new WLConfig(this.cordova.getActivity()).getAppURL().toString());
    String str2 = paramJSONArray.getString(0);
    if (str2 != null)
      str2 = str2.trim();
    boolean bool = paramJSONArray.getString(1).equals("true");
    String str3 = WLUtils.readWLPref(this.cordova.getActivity(), "wlSkinName");
    if ("updateApp".equals(paramString))
    {
      String str7 = new WLConfig(this.cordova.getActivity()).getAppURL().toString() + "updates?action=getzip&skin=" + str3;
      new WebResourcesDownloader((WLDroidGap)this.cordova, str1, str2, bool, "directUpdateDownloadingMessage", str7, str3).execute(new Void[0]);
    }
    while (true)
    {
      paramCallbackContext.success(PluginResult.Status.OK.name());
      return true;
      if (!"switchApp".equals(paramString))
        continue;
      String str4 = paramJSONArray.getString(1);
      String str5 = paramJSONArray.getString(2);
      String str6 = new WLConfig(this.cordova.getActivity()).getRootURL().toString() + "/dev/appdata?appId=" + str4 + "&appVer=" + str5 + "&appEnv=android&skin=" + str3;
      new WebResourcesDownloader((WLDroidGap)this.cordova, str1, str2, false, "downloadingWebResourcesMessage", str6, str3).execute(new Void[0]);
    }
  }
  catch (JSONException localJSONException)
  {
    paramCallbackContext.error("Action: " + paramString + " failed. " + localJSONException.getMessage());
  }
  return true;
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:40,代码来源:WebResourcesDownloaderPlugin.java

示例10: execute

import org.apache.cordova.api.CallbackContext; //导入方法依赖的package包/类
public boolean execute(String paramString, JSONArray paramJSONArray, CallbackContext paramCallbackContext)
  throws JSONException
{
  try
  {
    if ((!"updateApp".equals(paramString)) && (!"switchApp".equals(paramString)))
    {
      paramCallbackContext.error("Invalid action: " + paramString);
      return true;
    }
    String str1 = CookieManager.getInstance().getCookie(new WLConfig(this.cordova.getActivity()).getAppURL().toString());
    String str2 = paramJSONArray.getString(0);
    if (str2 != null)
      str2 = str2.trim();
    boolean bool = paramJSONArray.getString(1).equals("true");
    String str3 = WLUtils.readWLPref(this.cordova.getActivity(), "wlSkinName");
    if ("updateApp".equals(paramString))
    {
      String str7 = new WLConfig(this.cordova.getActivity()).getAppURL().toString() + "updates?action=getzip&skin=" + str3;
      new SSLWebResourcesDownloader((WLDroidGap)this.cordova, str1, str2, bool, "directUpdateDownloadingMessage", str7, str3).execute(new Void[0]);
    }
    while (true)
    {
      paramCallbackContext.success(PluginResult.Status.OK.name());
      return true;
      if (!"switchApp".equals(paramString))
        continue;
      String str4 = paramJSONArray.getString(1);
      String str5 = paramJSONArray.getString(2);
      String str6 = new WLConfig(this.cordova.getActivity()).getRootURL().toString() + "/dev/appdata?appId=" + str4 + "&appVer=" + str5 + "&appEnv=android&skin=" + str3;
      new SSLWebResourcesDownloader((WLDroidGap)this.cordova, str1, str2, false, "downloadingWebResourcesMessage", str6, str3).execute(new Void[0]);
    }
  }
  catch (JSONException localJSONException)
  {
    paramCallbackContext.error("Action: " + paramString + " failed. " + localJSONException.getMessage());
  }
  return true;
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:40,代码来源:SSLWebResourcesDownloaderPlugin.java

示例11: unbindService

import org.apache.cordova.api.CallbackContext; //导入方法依赖的package包/类
private void unbindService(CallbackContext paramCallbackContext)
{
  if (this.serviceConnection != null)
  {
    this.ctx.getApplicationContext().unbindService(this.serviceConnection);
    cancelNotification();
    paramCallbackContext.success();
    this.serviceConnection = null;
    return;
  }
  paramCallbackContext.error("no connection to service exists");
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:13,代码来源:ForegroundBinderPlugin.java

示例12: callback

import org.apache.cordova.api.CallbackContext; //导入方法依赖的package包/类
private boolean callback(String paramString, CallbackContext paramCallbackContext)
{
  if ("result:error".equals(paramString))
  {
    paramCallbackContext.error(PluginResult.Status.ERROR.name());
    return true;
  }
  paramCallbackContext.success(paramString);
  return true;
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:11,代码来源:DeviceAuthPlugin.java

示例13: execute

import org.apache.cordova.api.CallbackContext; //导入方法依赖的package包/类
public boolean execute(String paramString, JSONArray paramJSONArray, CallbackContext paramCallbackContext)
  throws JSONException
{
  ACTION localACTION = ACTION.fromString(paramString);
  if (localACTION != null)
  {
    if (this.cordova != null);
    for (Activity localActivity = this.cordova.getActivity(); ; localActivity = null)
      return localACTION.execute(paramJSONArray, paramCallbackContext, localActivity);
  }
  paramCallbackContext.error("Invalid action: " + paramString);
  return true;
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:14,代码来源:SecurityPlugin.java

示例14: execute

import org.apache.cordova.api.CallbackContext; //导入方法依赖的package包/类
/**
 * Executes the request.
 *
 * @param action        	The action to execute.
 * @param args          	JSONArry of arguments for the plugin.
 * @param callbackContext 	The callback context used when calling back into JavaScript.
 * @return              	True if the action was valid, false if not.
 */
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) {
    if (action.equals("start")) {
        if (this.batteryCallbackContext != null) {
            callbackContext.error( "Battery listener already running.");
            return true;
        }
        this.batteryCallbackContext = callbackContext;

        // We need to listen to power events to update battery status
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(Intent.ACTION_BATTERY_CHANGED);
        if (this.receiver == null) {
            this.receiver = new BroadcastReceiver() {
                @Override
                public void onReceive(Context context, Intent intent) {
                    updateBatteryInfo(intent);
                }
            };
            cordova.getActivity().registerReceiver(this.receiver, intentFilter);
        }

        // Don't return any result now, since status results will be sent when events come in from broadcast receiver
        PluginResult pluginResult = new PluginResult(PluginResult.Status.NO_RESULT);
        pluginResult.setKeepCallback(true);
        callbackContext.sendPluginResult(pluginResult);
        return true;
    }

    else if (action.equals("stop")) {
        removeBatteryListener();
        this.sendUpdate(new JSONObject(), false); // release status callback in JS side
        this.batteryCallbackContext = null;
        callbackContext.success();
        return true;
    }

    return false;
}
 
开发者ID:thedracle,项目名称:cordova-android-chromeview,代码行数:47,代码来源:BatteryListener.java

示例15: buy

import org.apache.cordova.api.CallbackContext; //导入方法依赖的package包/类
private void buy(Activity act, String sku, String payload, CallbackContext callbackContext){

        if (mHelper == null){
            callbackContext.error("Did you forget to initialize the plugin?");
            return;
        } 

        Log.d(TAG, "launching purchase flow for item purchase.");
        purchase(act, sku, payload, IabHelper.ITEM_TYPE_INAPP, ACT_CB_IAP, callbackContext);
    }
 
开发者ID:ldarren,项目名称:pico-phonegap-base,代码行数:11,代码来源:InAppBilling.java


注:本文中的org.apache.cordova.api.CallbackContext.error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。