Quantcast
Channel: Questions in topic: "assetbundles"
Viewing all articles
Browse latest Browse all 312

HttpWebRequest Async not working on Android

$
0
0
The following simple code wants to download an asset bundle asynchronously from a given URL: private void GetWebContent(String _url) { Debug.Log("Creating webrequest with URL = " + _url); _request = WebRequest.Create(_url); IAsyncResult responseAsyncResult = _request.BeginGetResponse(ResponseCallbackWebRequest, null); } private void ResponseCallbackWebRequest(IAsyncResult state) { Debug.Log("ResponseCallbackWebRequest webrequest with URL = " + _url + "\nstate = " + state.ToString()); // This is the last print that I get in Android WebResponse response = _request.EndGetResponse(state); Debug.Log("A"); // this line is never printed out long contentLength = response.ContentLength; if (contentLength == -1) { _error = "Could not get a response from " + url; Debug.Log(_error); } else { Debug.Log("Content Length is " + contentLength); } //... extra stuff here } I tried both my real asset bundle URL and something fake like 'http://www.google.com' and the result is pretty strange: the code behaves as expected under my Mac and silently fails under Android (no crashes, and the last line printed is the first Log from ResponseCallbackWebRequest). Is there anything terribly obvious that I'm missing?

Viewing all articles
Browse latest Browse all 312

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>