//This check is only for iOS IEnumerator CheckForConnectivityInBackground(bool showPrompt) { string iTunesServiceURL = ""; if (!string.IsNullOrEmpty(appStoreCountry)) { iTunesServiceURL = string.Format(kUniRateAppLookupURLFormat, appStoreCountry + "/"); } else { iTunesServiceURL = string.Format(kUniRateAppLookupURLFormat, ""); } if (appStoreID != 0) { iTunesServiceURL = iTunesServiceURL + "?id=" + appStoreID; } else { iTunesServiceURL = iTunesServiceURL + "?bundleId=" + applicationBundleID; } UniRateDebug.Log("Checking app info: " + iTunesServiceURL); bool errorHappened = false; WWW www = new WWW(iTunesServiceURL); yield return(www); if (String.IsNullOrEmpty(www.error)) //No error. Try parse app info from the returned text { UniRateAppInfo info = new UniRateAppInfo(www.text); if (info.validAppInfo) { if (info.bundleId.Equals(this.applicationBundleID)) //Everything goes ok { if (appStoreID == 0) { appStoreID = info.appID; UniRateDebug.Log("UniRate found the app, app id: " + appStoreID); } if (this.onlyPromptIfLatestVersion && !this.previewMode) { if (!applicationVersion.Equals(info.version)) { UniRateDebug.Log("No prompt because it is not the version in app store and you set onlyPromptIfLatestVersion."); errorHappened = true; UniRateFailWithError(Error.NotTheLatestVersion); } } } else { Debug.LogWarning("The bundle Id is not the same. Appstore: " + info.bundleId + " vs AppSetting:" + applicationBundleID); errorHappened = true; UniRateFailWithError(Error.BundleIdDoesNotMatchAppStore); } } else { if (appStoreID != 0) //We have a specified app id { Debug.LogWarning("No App info found with this app Id " + appStoreID); errorHappened = true; UniRateFailWithError(Error.AppNotFoundOnAppStore); } else { Debug.Log("No App info found with this bundle Id " + applicationBundleID); Debug.Log("Could not find your app on AppStore. It is normal when your app is not released, don't worry about this message."); } } } else { UniRateDebug.Log("Error happend in loading app information. Maybe due to no internet connection."); errorHappened = true; UniRateFailWithError(Error.NetworkError); } //Every thing goes ok. Prompt to rating now. if (!errorHappened) { _currentChecking = false; if (showPrompt) { ReadyToPrompt(); } else { OpenRatePage(); } } }
//This check is only for iOS IEnumerator CheckForConnectivityInBackground(bool showPrompt) { string iTunesServiceURL= ""; if (!string.IsNullOrEmpty(appStoreCountry)) { iTunesServiceURL = string.Format(kUniRateAppLookupURLFormat, appStoreCountry + "/"); } else { iTunesServiceURL = string.Format(kUniRateAppLookupURLFormat, ""); } if (appStoreID != 0) { iTunesServiceURL = iTunesServiceURL + "?id=" + appStoreID; } else { iTunesServiceURL = iTunesServiceURL + "?bundleId=" + applicationBundleID; } UniRateDebug.Log("Checking app info: " + iTunesServiceURL); bool errorHappened = false; WWW www = new WWW(iTunesServiceURL); yield return www; if (String.IsNullOrEmpty(www.error)) { //No error. Try parse app info from the returned text UniRateAppInfo info = new UniRateAppInfo(www.text); if (info.validAppInfo) { if (info.bundleId.Equals(this.applicationBundleID)) { //Everything goes ok if (appStoreID == 0) { appStoreID = info.appID; UniRateDebug.Log("UniRate found the app, app id: " + appStoreID); } if (this.onlyPromptIfLatestVersion && !this.previewMode) { if (!applicationVersion.Equals(info.version)) { UniRateDebug.Log("No prompt because it is not the version in app store and you set onlyPromptIfLatestVersion."); errorHappened = true; UniRateFailWithError(Error.NotTheLatestVersion); } } } else { Debug.LogWarning("The bundle Id is not the same. Appstore: " + info.bundleId + " vs AppSetting:" + applicationBundleID); errorHappened = true; UniRateFailWithError(Error.BundleIdDoesNotMatchAppStore); } } else { if (appStoreID != 0) { //We have a specified app id Debug.LogWarning("No App info found with this app Id " + appStoreID); errorHappened = true; UniRateFailWithError(Error.AppNotFoundOnAppStore); } else { Debug.Log("No App info found with this bundle Id " + applicationBundleID); Debug.Log("Could not find your app on AppStore. It is normal when your app is not released, don't worry about this message."); } } } else { UniRateDebug.Log("Error happend in loading app information. Maybe due to no internet connection."); errorHappened = true; UniRateFailWithError(Error.NetworkError); } //Every thing goes ok. Prompt to rating now. if (!errorHappened) { _currentChecking = false; if (showPrompt) { ReadyToPrompt(); } else { OpenRatePage(); } } }