public void SendViewData(ViewDataRequest viewDataRequest) { viewDataRequest.ID_Game = developerGameId; viewDataRequest.str_DevAccessToken = developerAccessToken; viewDataRequest.str_Device = DeviceId; viewDataRequest.str_Platform = Application.platform.ToString(); viewDataRequest.bit_withVR = UnityEngine.XR.XRDevice.isPresent ? 1 : 0; viewDataRequest.dat_Timestamp = GetTimestampString(); viewDataRequest.str_IDFA = HasAdvertiserId ? _advertiserId : ""; StartCoroutine(RequestSendViewData(viewDataRequest)); }
// ============================================================================== // RequestSendViewData_Coroutine // ============================================================================== IEnumerator RequestSendViewData(ViewDataRequest viewdataRequest) { var jsonString = JsonUtility.ToJson(viewdataRequest); var pData = System.Text.Encoding.ASCII.GetBytes(jsonString.ToCharArray()); var request = CreateWebRequest(SendViewDataUrl, pData); yield return(request.SendWebRequest()); if (!string.IsNullOrEmpty(request.error)) { if (Debug.isDebugBuild) { print("Error response: " + request.error); print("Error Message: " + request.downloadHandler.text); } } else { print("VIEW DATA RESPONSE: " + request.downloadHandler.text); var randomVreoResponse = JsonUtility.FromJson <VreoResponse>(request.downloadHandler.text); } }
// ============================================================================== // SendViewData // ============================================================================== public static void __SendViewData(ViewDataRequest viewDataRequest) { Instance.SendViewData(viewDataRequest); }