public static NativeResponse SyncSendMessage(MethodCall methodCall) { try { ToastLog.Debug(methodCall.ToJsonString()); var retMessage = ToastNativePlugin.Instance.NativePlugin.SyncSendMessage(methodCall); if (string.IsNullOrEmpty(retMessage)) { return(null); } ToastLog.Debug(retMessage); var response = NativeResponse.FromJson(retMessage); LogResponse(response); return(response); } catch (Exception e) { ToastLog.Error("ToastNativePlugin.Instance.NativePlugin.sendMessage Failed!"); ToastLog.Exception(e); ToastLog.Developer("Raise exception when calling a method : {0}\n{1}", e.Message, e.StackTrace); } return(null); }
public static NativeResponse SendMessage(MethodCall methodCall) { try { var retMessage = ToastNativePlugin.Instance.NativePlugin.SendMessage(methodCall); var response = NativeResponse.FromJson(retMessage); if (response != null) { LogResponse(response); } return(response); } catch (Exception e) { ToastLog.Error("ToastNativePlugin.Instance.NativePlugin.sendMessage Failed!"); ToastLog.Exception(e); } return(null); }
/// <summary> /// Receive callback data from native library /// </summary> // TODO Not Implementation method public void ReceiveFromNative(string message) { ToastLog.Debug("Receive nativeMethod : " + message); var response = NativeResponse.FromJson(message); var callbackId = response.Header.TransactionId; var callback = ToastCallbackManager.Instance[callbackId]; if (callback != null) { try { callback(response.Result, response); } finally { ToastCallbackManager.Instance.RemoveCallback(callbackId); } } }