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


Java Status.OK属性代码示例

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


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

示例1: javascriptCallback

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,代码行数:19,代码来源:TwilioVoicePlugin.java

示例2: run

@Override
public void run() {
  if (adSize == null) {
    result = new PluginResult(Status.ERROR, "AdSize is null. Did you use an AdSize constant?");
  } else {
    adView = new AdView(cordova.getActivity(), adSize, publisherId);
    adView.setAdListener(new BannerListener());
    LinearLayoutSoftKeyboardDetect parentView =
        (LinearLayoutSoftKeyboardDetect) webView.getParent();
    if (bannerAtTop) {
      parentView.addView(adView, 0);
    } else {
      parentView.addView(adView);
    }
    // Notify the plugin.
    result = new PluginResult(Status.OK);
  }
  synchronized (this) {
    this.notify();
  }
}
 
开发者ID:psydrake,项目名称:litecoinEasyCheck,代码行数:21,代码来源:AdMob.java

示例3: addAlarm

private PluginResult addAlarm(Context context, String what, Date when, ShowOption showOption, JSONObject extras){
PluginResult result = null;

// Create an alarm record
Alarm alarm = new Alarm();
alarm.setClassName(what);
alarm.setWhen(when);
alarm.setShowOption(showOption);
alarm.setExtras(extras);

// Now save the alarm
SchedulerDAL dal = new SchedulerDAL(context);
int id = dal.add(alarm);
if (id > 0) {
	dal.save();

	addToAlarmManager(context, alarm);

	result = new PluginResult(Status.OK, dal.getAsJSON(id));
} else {
	result = new PluginResult(Status.ERROR, "Unable to save Alarm details");
}

return result;
  }
 
开发者ID:Red-Folder,项目名称:Scheduler-Plugin,代码行数:25,代码来源:SchedulerPlugin.java

示例4: cancelAlarm

private PluginResult cancelAlarm(Context context, int id)
  {
PluginResult result = null;

Alarm alarm = new Alarm();
alarm.setId(id);

SchedulerDAL dal = new SchedulerDAL(context);
      dal.delete(alarm);
      dal.save();
      dal = null;
      
cancelFromAlarmManager(context, alarm);

result = new PluginResult(Status.OK);
return result;
  }
 
开发者ID:Red-Folder,项目名称:Scheduler-Plugin,代码行数:17,代码来源:SchedulerPlugin.java

示例5: updateAlarm

private PluginResult updateAlarm(Context context, int id, String what, Date when, ShowOption showOption, JSONObject extras)
  {
PluginResult result = null;

Alarm alarm = new Alarm();
alarm.setId(id);
alarm.setClassName(what);
alarm.setWhen(when);
alarm.setShowOption(showOption);
alarm.setExtras(extras);

SchedulerDAL dal = new SchedulerDAL(context);
dal.update(alarm);
dal.save();

cancelFromAlarmManager(context, alarm);
addToAlarmManager(context, alarm);

result = new PluginResult(Status.OK, dal.getAsJSON(id));

return result;
  }
 
开发者ID:Red-Folder,项目名称:Scheduler-Plugin,代码行数:22,代码来源:SchedulerPlugin.java

示例6: getActivityExtras

private PluginResult getActivityExtras(Context context) {
	PluginResult result = null;
	JSONObject data = new JSONObject();
	
	try {
		CordovaActivity activity = (CordovaActivity)context;
		Bundle extras = activity.getIntent().getExtras();
		
		if (extras != null) {
			Set<String> keys = extras.keySet();
			Iterator<String> it = keys.iterator();
			while (it.hasNext()) {
				String key = it.next();
				Object value = extras.get(key);
				data.put(key, value);
			}
		}
	} catch (Exception ex) {
		Log.d(TAG, "Error while trying to get extra data", ex);
	}
	
	result = new PluginResult(Status.OK, data);
	
	return result;
}
 
开发者ID:Red-Folder,项目名称:Scheduler-Plugin,代码行数:25,代码来源:SchedulerPlugin.java

示例7: sendCallback

/**
 * Send plugin result.
 *
 * @param callbackString
 * @param keepCallback
 */
private void sendCallback(String callbackString, boolean keepCallback) {
    if (!_ctx.isFinished()) {
        PluginResult result = new PluginResult(Status.OK, callbackString);
        result.setKeepCallback(keepCallback);
        _ctx.sendPluginResult(result);
    }
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:13,代码来源:WebSocketGenerator.java

示例8: speak

private PluginResult speak(JSONArray data, CallbackContext callbackContext){// String callbackId) {

		try {
			
			String text = data.getString(0);
			boolean isSsml = data.getBoolean(2);
			
			String voice = null;
			if(data.length() > 3){
				voice = data.getString(3);
			}
			
			NuanceEngine.getInstance().setVoice(voice);
			NuanceEngine.getInstance().speak(text, isSsml, createVocalizerHandler(callbackContext));
			
			PluginResult result;
			if(callbackContext != null){
				result = new PluginResult(Status.NO_RESULT);
				result.setKeepCallback(true);
			}
			else {
				result = new PluginResult(Status.OK);
			}
			
			return result;
		} catch (JSONException e) {
			LOG.e(PLUGIN_NAME, "Failed to synthesize text!", e);
			return new PluginResult(Status.JSON_EXCEPTION, "Failed to synthesize text!");
		}

	}
 
开发者ID:mmig,项目名称:mmir-plugin-speech-nuance,代码行数:31,代码来源:NuanceSpeechPlugin.java

示例9: onRecordingBegin

@Override
public void onRecordingBegin(Recognizer recognizer) {

    //TODO add callback for start-recording/-recognizing event (+ JavaScript)
	
	if(isPreventPauseDuringRecognition){
		setWakeLock(true);
	}
	
    LOG.d(HANDLER_NAME, "RecordingBegin");

    JSONObject result = new JSONObject();
    try {
        result.put(RECOGNITION_RESULT_FIELD_NAME, "");
        result.put(RECOGNITION_RESULT_SCORE_FIELD_NAME, -1);
        result.put(RECOGNITION_TYPE_FIELD_NAME, ResultTypes.RECORDING_BEGIN.toString());
    } catch (JSONException e) {
        e.printStackTrace();
    }

    PluginResult recBeginResult = new PluginResult(Status.OK, result);
    recBeginResult.setKeepCallback(true);

    currentCallbackContext.sendPluginResult(recBeginResult);
    
    recording = true;
    
    //remember recognizer 
    // (we need this instance, if we want to store the audio levels during recording)
	currentRecognizer = recognizer;
	//if audio levels were already requested, start storing them now:
	if(isAudioLevelsRequested)
		startStoringAudioLevels();
    
}
 
开发者ID:mmig,项目名称:mmir-plugin-speech-nuance,代码行数:35,代码来源:NuanceSpeechPlugin.java

示例10: onRecordingDone

@Override
        public void onRecordingDone(Recognizer recognizer) {
        	 
        	recording = false;
        	
            //TODO (?) add callback for finished-recording/start-recognizing event (+ JavaScript)
//            LOG.d(HANDLER_NAME, "RecordingDone");
        	if(isPreventPauseDuringRecognition){
        		setWakeLock(false);
        	}

            if (isStopped){
                LOG.d(HANDLER_NAME, "RecordingDone - stopped");
                isFinal = true;
            } else if (isCancelled){
                LOG.d(HANDLER_NAME, "RecordingDone - cancelled");
            } else {
                LOG.d(HANDLER_NAME, "RecordingDone");
            }

            JSONObject result = new JSONObject();
            try {
                result.put(RECOGNITION_RESULT_FIELD_NAME, "");
                result.put(RECOGNITION_RESULT_SCORE_FIELD_NAME, -1);
                result.put(RECOGNITION_TYPE_FIELD_NAME, ResultTypes.RECORDING_DONE.toString());
            } catch (JSONException e) {
                e.printStackTrace();
            }

            PluginResult recDoneResult = new PluginResult(Status.OK, result);
            recDoneResult.setKeepCallback(true);

            currentCallbackContext.sendPluginResult(recDoneResult);
        }
 
开发者ID:mmig,项目名称:mmir-plugin-speech-nuance,代码行数:34,代码来源:NuanceSpeechPlugin.java

示例11: sendReceiveEvent

private void sendReceiveEvent(int socketId, byte[] data) {
  List<PluginResult> multipartMessage = new ArrayList<PluginResult>();
  multipartMessage.add(new PluginResult(Status.OK, "onReceive"));
  multipartMessage.add(new PluginResult(Status.OK, socketId));
  multipartMessage.add(new PluginResult(Status.OK, data));
  PluginResult result = new PluginResult(Status.OK, multipartMessage);
  result.setKeepCallback(true);
  bluetoothSocketEventsCallback.sendPluginResult(result);
}
 
开发者ID:MobileChromeApps,项目名称:cordova-plugin-chrome-apps-bluetoothSocket,代码行数:9,代码来源:ChromeBluetoothSocket.java

示例12: onPurchaseStart

@Override
  public void onPurchaseStart(InAppService sender, String productId)  {
if (listenerCtx != null) {
	JSONArray data = new JSONArray();
	data.put("start");
	data.put(productId);
	PluginResult result = new PluginResult(Status.OK, data);
	result.setKeepCallback(true);
	listenerCtx.sendPluginResult(result);
}
  }
 
开发者ID:ludei,项目名称:atomic-plugins-inapps,代码行数:11,代码来源:InAppServicePlugin.java

示例13: onPurchaseFail

@Override
public void onPurchaseFail(InAppService sender, String productId, Error error) {
	if (listenerCtx != null) {
		JSONArray data = new JSONArray();
		data.put("error");
		data.put(productId);
		data.put(this.errorToJSON(error));
		PluginResult result = new PluginResult(Status.OK, data);
		result.setKeepCallback(true);
		listenerCtx.sendPluginResult(result);
	}
   }
 
开发者ID:ludei,项目名称:atomic-plugins-inapps,代码行数:12,代码来源:InAppServicePlugin.java

示例14: onPurchaseComplete

@Override
public void onPurchaseComplete(InAppService sender, InAppPurchase purchase){
	if (listenerCtx != null) {
		JSONArray data = new JSONArray();
		data.put("complete");
		data.put(purchase.toJSON());
		PluginResult result = new PluginResult(Status.OK, data);
		result.setKeepCallback(true);
		listenerCtx.sendPluginResult(result);
	}
   }
 
开发者ID:ludei,项目名称:atomic-plugins-inapps,代码行数:11,代码来源:InAppServicePlugin.java

示例15: setLanguage

private PluginResult setLanguage(String language) {
	NuanceEngine.getInstance().setLanguage(language);
	LOG.d(PLUGIN_NAME, "Language set to " + language);
	return new PluginResult(Status.OK);
}
 
开发者ID:mmig,项目名称:mmir-plugin-speech-nuance,代码行数:5,代码来源:NuanceSpeechPlugin.java


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