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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -