performance - Xamarin Android First web request deadly slow -
the first call made android xamarin app deadly slow, taking 10 times required time.
i tried coding options "httpclient", "webclient" etc
for instance:
public string makewebrequest(string url) { try { string responsecontent; httpwebrequest request = (httpwebrequest)webrequest.create(url); request.method = "get"; request.headers.add(httprequestheader.authorization, "bearer " + token); request.proxy = globalproxyselection.getemptywebproxy(); // null; using (httpwebresponse response = (httpwebresponse)request.getresponse()) { using (stream responsestream = response.getresponsestream()) { using (streamreader sr = new streamreader(responsestream)) responsecontent = sr.readtoend(); } } return responsecontent; } catch (exception ex) { return ex.message; } }
i tried same code windows phone app , works in 1/10 of time. console app, same result. tried on many device no success.
all other requests works well.
how can solve it?
Comments
Post a Comment