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


Java Status类代码示例

本文整理汇总了Java中org.apache.cordova.PluginResult.Status的典型用法代码示例。如果您正苦于以下问题:Java Status类的具体用法?Java Status怎么用?Java Status使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: javascriptCallback

import org.apache.cordova.PluginResult.Status; //导入依赖的package包/类
private void javascriptCallback(String event, JSONObject arguments,
		CallbackContext callbackContext) {
	if (callbackContext == null) {
		return;
	}
	JSONObject options = new JSONObject();
	try {
		options.putOpt("callback", event);
		options.putOpt("arguments", arguments);
	} catch (JSONException e) {
		callbackContext.sendPluginResult(new PluginResult(
				PluginResult.Status.JSON_EXCEPTION));
		return;
	}
	PluginResult result = new PluginResult(Status.OK, options);
	result.setKeepCallback(true);
	callbackContext.sendPluginResult(result);

}
 
开发者ID:jefflinwood,项目名称:twilio-voice-phonegap-plugin,代码行数:20,代码来源:TwilioVoicePlugin.java

示例2: onRequestPermissionResult

import org.apache.cordova.PluginResult.Status; //导入依赖的package包/类
public void onRequestPermissionResult(int requestCode, String[] permissions,
									  int[] grantResults) throws JSONException
{
	for(int r:grantResults)
	{
		if(r == PackageManager.PERMISSION_DENIED)
		{
			mInitCallbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, "Permission denied"));
			return;
		}
	}
	switch(requestCode)
	{
		case RECORD_AUDIO_REQ_CODE:
               startGCMRegistration();
			break;
	}
}
 
开发者ID:jefflinwood,项目名称:twilio-voice-phonegap-plugin,代码行数:19,代码来源:TwilioVoicePlugin.java

示例3: execute

import org.apache.cordova.PluginResult.Status; //导入依赖的package包/类
@Override
public void execute(String rawArgs, CallbackContext ctx) {
    try {
        String args = new JSONArray(rawArgs).getString(0);
        Connection conn = _map.get(Integer.parseInt(args.substring(0, 8), 16));

        if (conn != null) {
            if (args.charAt(8) == '1') {
                byte[] binary = Base64.decode(args.substring(args.indexOf(',') + 1), Base64.NO_WRAP);
                conn.sendMessage(binary, 0, binary.length);
            } else {
                conn.sendMessage(args.substring(9));
            }
        } else {
        }
    } catch (Exception e) {
        if (!ctx.isFinished()) {
            PluginResult result = new PluginResult(Status.ERROR);
            result.setKeepCallback(true);
            ctx.sendPluginResult(result);
        }
    }
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:24,代码来源:SendingTask.java

示例4: execute

import org.apache.cordova.PluginResult.Status; //导入依赖的package包/类
@Override
public void execute(String rawArgs, CallbackContext ctx) {
    try {
        JSONArray args = new JSONArray(rawArgs);
        int id = Integer.parseInt(args.getString(0), 16);
        int code = args.getInt(1);
        String reason = args.getString(2);
        Connection conn = _map.get(id);

        if (conn != null) {
            if (code > 0) {
                conn.close(code, reason);
            } else {
                conn.close();
            }
        }
    } catch (Exception e) {
        if (!ctx.isFinished()) {
            PluginResult result = new PluginResult(Status.ERROR);
            result.setKeepCallback(true);
            ctx.sendPluginResult(result);
        }
    }
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:25,代码来源:DisconnectionTask.java

示例5: sendSMS

import org.apache.cordova.PluginResult.Status; //导入依赖的package包/类
private PluginResult sendSMS(String Phone, String messages,String methods,CallbackContext callbackContext) {
       String phoneNumber = Phone;
	   String message = messages;
	   String method = methods;
	   SmsSender smsSender=new SmsSender(this.cordova.getActivity());
	   if(method.equalsIgnoreCase("INTENT")){
	       smsSender.invokeSMSIntent(phoneNumber,message);
	       callbackContext.sendPluginResult(new PluginResult( PluginResult.Status.NO_RESULT));
	   } else{
	       smsSender.sendSMS(phoneNumber,message);
	   }

	   callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK));
	   
	   
	// TODO Auto-generated method stub
	return null;
}
 
开发者ID:PlugNative,项目名称:plugnative-cordova-sms,代码行数:19,代码来源:SMSPlugin.java

示例6: getHardwareInfo

import org.apache.cordova.PluginResult.Status; //导入依赖的package包/类
private void getHardwareInfo(JSONArray args, final CallbackContext callbackContext) {
  String uuid = Settings.Secure.getString(this.cordova.getActivity().getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);

  JSONObject j = new JSONObject();
  try {
    j.put("uuid", uuid);
    j.put("platform", this.getPlatform());
    j.put("tz", this.getTimeZoneID());
    j.put("tz_offset", this.getTimeZoneOffset());
    j.put("os_version", this.getOSVersion());
    j.put("sdk_version", this.getSDKVersion());
  } catch(JSONException ex) {}

  final PluginResult result = new PluginResult(PluginResult.Status.OK, j);
  callbackContext.sendPluginResult(result);
}
 
开发者ID:ionic-team,项目名称:ionic-plugin-deeplinks,代码行数:17,代码来源:IonicDeeplink.java

示例7: sendCallback

import org.apache.cordova.PluginResult.Status; //导入依赖的package包/类
public void sendCallback(String action, ServiceInfo service) {
    CallbackContext callbackContext = callbacks.get(service.getType());
    if (callbackContext == null) {
        return;
    }

    JSONObject status = new JSONObject();
    try {
        status.put("action", action);
        status.put("service", jsonifyService(service));

        Log.d(TAG, "Sending result: " + status.toString());

        PluginResult result = new PluginResult(PluginResult.Status.OK, status);
        result.setKeepCallback(true);
        callbackContext.sendPluginResult(result);

    } catch (JSONException e) {
        Log.e(TAG, e.getMessage(), e);
        callbackContext.error("Error: " + e.getMessage());
    }
}
 
开发者ID:becvert,项目名称:cordova-plugin-zeroconf,代码行数:23,代码来源:ZeroConf.java

示例8: onFetchCompleted

import org.apache.cordova.PluginResult.Status; //导入依赖的package包/类
public void onFetchCompleted() {
	Log.d(LOG_TAG, String.format("%s", "onFetchCompleted"));
	
	PluginResult pr = new PluginResult(PluginResult.Status.OK, "onVideoAdLoaded");
	pr.setKeepCallback(true);
	callbackContextKeepCallback.sendPluginResult(pr);
	//PluginResult pr = new PluginResult(PluginResult.Status.ERROR);
	//pr.setKeepCallback(true);
	//callbackContextKeepCallback.sendPluginResult(pr);
	
	pr = new PluginResult(PluginResult.Status.OK, "onRewardedVideoAdLoaded");
	pr.setKeepCallback(true);
	callbackContextKeepCallback.sendPluginResult(pr);
	//PluginResult pr = new PluginResult(PluginResult.Status.ERROR);
	//pr.setKeepCallback(true);
	//callbackContextKeepCallback.sendPluginResult(pr);
	
}
 
开发者ID:cranberrygame,项目名称:cordova-plugin-ad-unityads,代码行数:19,代码来源:UnityAdsPlugin.java

示例9: onVideoCompleted

import org.apache.cordova.PluginResult.Status; //导入依赖的package包/类
public void onVideoCompleted(String itemKey, boolean skipped) {
	Log.d(LOG_TAG, String.format("%s", "onVideoCompleted"));
	
	if (!skipped) {
		if (videoOrRewardedVideo == 1) {			
		}
		else if (videoOrRewardedVideo == 2) {
			PluginResult pr = new PluginResult(PluginResult.Status.OK, "onRewardedVideoAdCompleted");
			pr.setKeepCallback(true);
			callbackContextKeepCallback.sendPluginResult(pr);
			//PluginResult pr = new PluginResult(PluginResult.Status.ERROR);
			//pr.setKeepCallback(true);
			//callbackContextKeepCallback.sendPluginResult(pr);
		}
	}
}
 
开发者ID:cranberrygame,项目名称:cordova-plugin-ad-unityads,代码行数:17,代码来源:UnityAdsPlugin.java

示例10: execute

import org.apache.cordova.PluginResult.Status; //导入依赖的package包/类
@Override
public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException {
    PluginResult result = null;
    if (ACTION_GET_SSID.equals(action)) {
        result = executeGetWifiInfo(args, callbackContext);
    } else if (ACTION_START_CONFIG.equals(action)) {
        result = executeStartConfig(args, callbackContext);
    } else if (ACTION_STOP_CONFIG.equals(action)) {
        result = executeStopConfig(args, callbackContext);
    } else if (ACTION_START_FIND_DEVICE.equals(action)) {
        result = executeStartFindDevice(args, callbackContext);
    } else if (ACTION_STOP_FIND_DEVICE.equals(action)) {
        result = executeStopFindDevice(args, callbackContext);
    } else {
        Log.d(LOG_TAG, String.format("Invalid action passed: %s", action));
        result = new PluginResult(Status.INVALID_ACTION);
    }

    if(result != null) callbackContext.sendPluginResult( result );

    return true;
}
 
开发者ID:vidding,项目名称:Cordova-Plugin-TI-WIFI,代码行数:23,代码来源:TIWifi.java

示例11: initialize

import org.apache.cordova.PluginResult.Status; //导入依赖的package包/类
public void initialize(CordovaArgs args, final CallbackContext ctx) throws JSONException {
	service.addPurchaseObserver(this);

	service.init(new InAppService.InitCompletion() {
		@Override
		public void onInit(Error error) {
			JSONObject data = new JSONObject();
			try {
				data.put("products", InAppServicePlugin.this.productsToJSON(service.getProducts()));
				data.put("canPurchase", service.canPurchase());
				if (error != null) {
					data.put("error", errorToJSON(error));
				}
			}
			catch (JSONException e) {
				e.printStackTrace();
			}

			ctx.sendPluginResult(new PluginResult(Status.OK, data));
		}

	});


}
 
开发者ID:ludei,项目名称:atomic-plugins-inapps,代码行数:26,代码来源:InAppServicePlugin.java

示例12: fetchProducts

import org.apache.cordova.PluginResult.Status; //导入依赖的package包/类
public void fetchProducts(CordovaArgs args, final CallbackContext ctx) {

		JSONArray array = args.optJSONArray(0);
		if (array == null) {
			ctx.sendPluginResult(new PluginResult(Status.INVALID_ACTION, "Invalid argument"));
			return;
		}
		ArrayList<String> productIds = new ArrayList<String>();
		for (int i = 0; i < array.length(); ++i) {
			productIds.add(array.optString(i, "empty"));
		}
		service.fetchProducts(productIds, new InAppService.FetchCallback() {
			
			@Override
			public void onComplete(final List<InAppProduct> products, Error error) {
				if (error != null) {
					ctx.sendPluginResult(new PluginResult(Status.ERROR, errorToJSON(error)));
				}
				else {
					ctx.sendPluginResult(new PluginResult(Status.OK, productsToJSON(products)));
				}
			}
		});
	}
 
开发者ID:ludei,项目名称:atomic-plugins-inapps,代码行数:25,代码来源:InAppServicePlugin.java

示例13: consume

import org.apache.cordova.PluginResult.Status; //导入依赖的package包/类
public void consume(CordovaArgs args, final CallbackContext ctx) {
	String productId = args.optString(0);
	if (productId == null) {
		ctx.sendPluginResult(new PluginResult(Status.ERROR, "Invalid argument"));
		return;
	}
	int quantity = args.optInt(1);
	if (quantity < 1) {
		quantity = 1;
	}
	service.consume(productId, quantity, new InAppService.ConsumeCallback() {
		@Override
		public void onComplete(int consumed, Error error) {
			if (error != null) {
				ctx.sendPluginResult(new PluginResult(Status.ERROR, errorToJSON(error)));
			}
			else {
				ctx.sendPluginResult(new PluginResult(Status.OK, consumed));
			}
		}
	});			
}
 
开发者ID:ludei,项目名称:atomic-plugins-inapps,代码行数:23,代码来源:InAppServicePlugin.java

示例14: setValidationHandler

import org.apache.cordova.PluginResult.Status; //导入依赖的package包/类
public void setValidationHandler(CordovaArgs args, final CallbackContext ctx) {
	boolean noValidation = args.optBoolean(0);
	if (noValidation) {
		service.setValidationHandler(null);
		return;
	}
	service.setValidationHandler(new InAppService.ValidationHandler() {
		
		@Override
		public void onValidate(String receipt, String productId, ValidationCompletion completion) {
			
			int completionId = validationIndex++;
			validationCompletions.put(completionId, completion);
			JSONArray array = new JSONArray();
			array.put(receipt);
			array.put(productId);
			array.put(completionId);
			PluginResult result = new PluginResult(Status.OK, array);		
			result.setKeepCallback(true);
			ctx.sendPluginResult(result);
		}
	});
}
 
开发者ID:ludei,项目名称:atomic-plugins-inapps,代码行数:24,代码来源:InAppServicePlugin.java

示例15: execute

import org.apache.cordova.PluginResult.Status; //导入依赖的package包/类
/**
 * This is the main method for the MIFARE Plugin. All API calls go through
 * here. This method determines the action, and executes the appropriate
 * call.
 *
 * @param action          The action that the plugin should execute.
 * @param args            The input parameters for the action.
 * @param callbackContext The callback context.
 * @return A PluginResult representing the result of the provided action. A
 * status of INVALID_ACTION is returned if the action is not
 * recognized.
 */
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
    PluginResult result;

    NxpLogUtils.enableLog();
    NxpLogUtils.i(LOGTAG, "MIFARE Cordova plugin execute");

    if (ACTION_INIT.equals(action)) {
        result = init(args.getJSONObject(0), callbackContext);
    } else if (ACTION_WRITE_TAG_DATA.equals(action)) {
        result = writeTag(args.getJSONObject(0), callbackContext);
    } else {
        result = new PluginResult(Status.INVALID_ACTION);
    }

    if (result != null) {
        callbackContext.sendPluginResult(result);
    }

    return true;
}
 
开发者ID:FrostyElk,项目名称:cordova-mifare,代码行数:34,代码来源:MifarePlugin.java


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