I am developing an application for WP7
. For tests I used an emulator and everything was cool. For communication with the server used WebClient
and RestClient
. But after testing a ready-made application on a real device, such a thing came to light:
private void LoadData() { var webClient = new WebClient(); webClient.DownloadStringCompleted += DownloadStringCompleted; webClient.DownloadStringAsync(new Uri(Constants.Url1)); //Point_1 } private void DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { //Point_2 }
On the emulator between Point_1 and Point_2 0.8-1.2 seconds. On the device (HTC Radar) between Point_1 and Point_2 15-20 seconds.
var request = new RestRequest(url) {Method = Method.POST}; //Point_3 RestClient.ExecuteAsync(request, response => { //Point_4 }
On the emulator between Point_3 and Point_4 0.3-0.5 seconds. On the device (HTC Radar) between Point_3 and Point_4 18-22 seconds.
I have 3 questions:
- First: Is this normal?
- Second: Why is this happening?
- Third: How can you solve this problem of wasting time?