Beispiel #1
0
        private IEnumerator logSessionOnServer()
        {
            yield return(new WaitForSeconds(1f)); //Wait a few seconds to allow other params to get generated.

            while (!triedToFetchAdvertisingId)
            {
                yield return(new WaitForSeconds(0.1f));
            }

            if (AdGem.verboseLogging)
            {
                Debug.Log("session url: " + AdGemPlugin.baseApiUrl + "session?" + AdGemPlugin.getStandardQueryParameters());
            }

            UnityEngine.Networking.UnityWebRequest webRequest = UnityEngine.Networking.UnityWebRequest.Get(AdGemPlugin.baseApiUrl + "session?" + AdGemPlugin.getStandardQueryParameters());
            yield return(webRequest.SendWebRequest());

            sentSessionRequest = true;

            //get should poll
            try
            {
                JSONNode baseJson = JSON.Parse(webRequest.downloadHandler.text);
                JSONNode dataNode = baseJson["data"].AsObject;
                shouldPoll = dataNode["should_poll"].AsInt > 0;

                //Debug.Log(dataNode["offerwall_color"].Value);
                //AdGemOfferWall.staticRef.setBgColor(dataNode["offerwall_color"].Value);
            }
            catch (System.Exception ex) { if (AdGem.verboseLogging)
                                          {
                                              Debug.Log(ex.ToString());
                                          }
            }

            //if (AdGem.verboseLogging) { Debug.Log("adgem--- session response: " + webRequest.downloadHandler.text); }
        }
Beispiel #2
0
        public void fireEventEndpoint(string eventName, string adTypeParam, string videoCacheId)
        {
            string eventUrl = AdGemPlugin.baseApiUrl + eventName + "?ad_type=" + adTypeParam + "&video_cache_id=" + videoCacheId + AdGemPlugin.getStandardQueryParameters();

            fireEventEndpoint(eventUrl);
        }