List of usage examples for org.apache.cordova.api LOG e
public static void e(String tag, String s, Object... args)
From source file:de.dfki.iui.opentok.cordova.plugin.OpenTokPlugin.java
License:Open Source License
private boolean sendException(String errorMessage) { Exception exc = new OpenTokPluginError(errorMessage); //remove first element form stack trace, since we want the // calling method as first entry in the stack trace // (and not this method itself) StackTraceElement[] stack = exc.getStackTrace(); exc.setStackTrace(getStackTrace(stack, 1, stack.length - 1)); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); exc.printStackTrace(pw);/*from w w w .j a v a 2 s . c o m*/ errorMessage = sw.toString(); if (this._exceptionCallback != null) { PluginResult excResult = new PluginResult(PluginResult.Status.ERROR, errorMessage); excResult.setKeepCallback(true); OpenTokPlugin.this._exceptionCallback.sendPluginResult(excResult); return true; } else { LOG.e(PLUGIN_NAME, errorMessage, exc); return false; } }
From source file:de.dfki.iui.opentok.cordova.plugin.OpenTokPlugin.java
License:Open Source License
@SuppressLint("DefaultLocale") private PluginResult doUpdateView(String sid, int top, int left, int width, int height, int zIndex) { try {//FIXME TEST LOG.i(PLUGIN_NAME,//from w ww.j a v a 2 s . c o m String.format( "updateView with arguments: sid %s, top %d, left %d, width %d, height %d, zIndex %d", sid, top, left, width, height, zIndex)); if (_publisher != null && sid.equals(ID_PUBLISHER)) { LOG.i(PLUGIN_NAME, String.format("The Width is: %d", width)); // LayoutParams layoutParams = createLayoutParams(left, top, width, height); //// _publisher.getView().setLeft(left); //// _publisher.getView().setTop(top); // _publisher.getView().setX(left); // _publisher.getView().setY(top); // publisherViewContainer.addView(mPublisher.getView(), layoutParams); // this.publisherViewParams = new ViewParams(left, top, width, height, zIndex); // LayoutParams params = this.publisherViewParams.create();//this.createLayoutParams(left, top, width, height); LayoutParams params = this.createLayoutParams(left, top, width, height); // _publisher.getView().setLayoutParams(params);//frame = CGRectMake(left, top, width, height); doUpdateViewLayoutParams(_publisher.getView(), params); // _publisher.view.layer.zPosition = zIndex; if (_publisherAudioIcon != null) { LayoutParams iParams = createIconLayoutParams(top, left, width, height); int micStatus = getIconResourceForPublisherStatus(); int micIconVisiblity = getIconVisibilityForPublisherStatus(); doUpdateViewIcon(_publisherAudioIcon, iParams, micStatus, micIconVisiblity); } } // Subscriber streamInfo = subscriberDictionary.get(sid); // if (streamInfo) { // // Reposition the video feeds! // streamInfo.view.frame = CGRectMake(left, top, width, height); // streamInfo.view.layer.zPosition = zIndex; // } if (streamInfo != null) { // Reposition the video feeds! ViewParams viewParams = new ViewParams(left, top, width, height, zIndex);//subscriberViewParams.get(sid); subscriberViewParams.put(sid, viewParams); LayoutParams newPosition = this.createLayoutParams(left, top, width, height);//viewParams.create();// this.createLayoutParams(left, top, width, height); // streamInfo.getView().setLayoutParams(newPosition); doUpdateViewLayoutParams(streamInfo.getView(), newPosition); ImageView subscriberAudioIcon = subscriberAudioIconDictionary.get(sid); if (subscriberAudioIcon != null) { LayoutParams iParams = createIconLayoutParams(top, left, width, height); int speakerStatus = getIconResourceForSubscriberStatus(streamInfo); int speakerIconVisiblity = getIconVisibilityForSubscriberStatus(streamInfo); doUpdateViewIcon(subscriberAudioIcon, iParams, speakerStatus, speakerIconVisiblity); } } PluginResult result = new PluginResult(PluginResult.Status.OK, String.format("updateView [stream %s, top %d, left %d, width %d, height %d, zIndex %d]", sid, top, left, width, height, zIndex)); result.setKeepCallback(true); return result; } catch (Exception e) { String msg = String.format( "error during updateView with arguments: sid %s, top %d, left %d, width %d, height %d, zIndex %d", sid, top, left, width, height, zIndex); System.err.println(msg); e.printStackTrace(); LOG.e(PLUGIN_NAME, msg, e); throw (new RuntimeException( "This is a 'proxied' Exception (for 'real' Exception, see first entry in stack-trace)", e)); } }
From source file:de.dfki.iui.opentok.cordova.plugin.OpenTokPlugin.java
License:Open Source License
private void doTBTesting(CallbackContext callbackContext) { if (_exceptionCallback == null) { _exceptionCallback = callbackContext; }/* w w w . j a va 2 s . c o m*/ JSONObject response = new JSONObject(); try { response.put("message", "HMMM Test Error!"); } catch (JSONException e) { // e.printStackTrace(); if (isError()) LOG.e(PLUGIN_NAME, "Could not create response (no ERROR listener registered)", e); } PluginResult result = new PluginResult(PluginResult.Status.OK, response); result.setKeepCallback(true); callbackContext.sendPluginResult(result); }
From source file:de.dfki.iui.opentok.cordova.plugin.OpenTokPlugin.java
License:Open Source License
/** * WORKAROUND: the current Android impl. does not provide the session's connection on connecting * -> if the JAVASCRIPT code receives the connect-event without a connection for the session * it will register a callback * -> when the publisher starts, we use its connection as session-connection * //from ww w . j a v a 2 s .c om * If there was no callback set, this method does nothing. * * After successfully sending the connection-information, the callback-instance will be reset to NULL, * i.e. the information will only be sent 1 time. * */ private void doSendSessionConnectionData() { if (retrieveSessionConnectionCallback != null) { // After session is successfully connected, the connection property is available JSONObject connData = new JSONObject(); PluginResult result; try { String sessionConnectionId = this.mListener.getConnectionId(_session); connData.put("connectionId", sessionConnectionId); connData.put("data", _session.getConnection().getData()); String creationTime = String.format("%d", _session.getConnection().getCreationTime().getTime()); connData.put("creationTime", creationTime); result = new PluginResult(PluginResult.Status.OK, connData); } catch (JSONException e) { if (isError()) LOG.e(PLUGIN_NAME, "Could not create response", e); result = new PluginResult(PluginResult.Status.ERROR, "Could not create response object: " + e); } retrieveSessionConnectionCallback.sendPluginResult(result); retrieveSessionConnectionCallback = null; } }