private void Start() { log("Start"); //ChocolateUnityBridge.SetAdRequestTestMode(true, "xxxxxxxx"); //OPTIONAL TEST MODE //appInfo is mandatory. However, ads can still be fetched. ChocolateUnityBridge.setAppInfo("MyAppName", "MyPublisherName", "MyDomainName", "PublisherDomain", "MyPlayStoreUrl", "My IAB Category"); //OPTIONAL: Ad Request User Parameters //ChocolateUnityBridge.SetAdRequestUserParams(18, "", "M", "Single", "Asian", "", "", "", "", ""); ChocolateUnityBridge.initWithAPIKey("XqjhRR"); //Our test key. Replace with yours in production. ChocolateUnityBridge.setInterstitialAdListener(this); ChocolateUnityBridge.setRewardAdListener(this); }
IEnumerator Start() { Screen.fullScreen = false; //Disable Fullscreen App AlertCanvas.enabled = false; GUITextMessage.enabled = false; string apiKey = ""; #if UNITY_IOS apiKey = "X4mdFv"; #endif #if UNITY_ANDROID apiKey = "XqjhRR"; #endif ChocolateUnityBridge.initWithAPIKey(apiKey); ChocolateUnityBridge.SetAdRequestTestMode(true, "dinosaur"); ChocolateUnityBridge.setPrivacySettings( true, //whether GDPR applies null //consent string in format defined by IAB, or null if no consent was obtained ); // First, check if user has location service enabled if (!Input.location.isEnabledByUser) { yield break; } // Start service before querying location Input.location.Start(); // Wait until service initializes int maxWait = 20; while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0) { yield return(new WaitForSeconds(1)); maxWait--; } // Service didn't initialize in 20 seconds if (maxWait < 1) { print("Timed out"); yield break; } // Connection has failed if (Input.location.status == LocationServiceStatus.Failed) { print("Unable to determine device location"); yield break; } else { // Access granted and location value could be retrieved latitude = string.Format("{0:N3}", Input.location.lastData.latitude); longitude = string.Format("{0:N3}", Input.location.lastData.longitude); print("Location: " + Input.location.lastData.latitude + " " + Input.location.lastData.longitude + " " + Input.location.lastData.altitude + " " + Input.location.lastData.horizontalAccuracy + " " + Input.location.lastData.timestamp); } // Stop service if there is no need to query location updates continuously Input.location.Stop(); }