Hi.
I am back after a year. Had some seriously work in a job.
I starting to learn differences in 4.3.
I want to know what is the best approach to get web pages. I mostly want to post some data with GET parameters, or download files.
I try with this code:
void SendValue(string Location, double temp, double hum)
{
if (!_IsTimeSet || !net.NetworkIsAvailable)
return;
string url = StringUtils.Format(ShareConst.HttpMicrocontrolerUrl + "PostMeasurements.php?location={0}", Location);
if (!double.IsNaN(temp))
url += "&temperature=" + temp;
if (!double.IsNaN(hum))
url += "&humidity=" + hum;
HttpRequest request = WebClient.GetFromWeb(url);
request.ResponseReceived += (HttpRequest sender, HttpResponse response) =>
{
if (response.StatusCode == "200")
{
}
else
{
Debug.Print(StringUtils.Format("Measurement send: Location={1}, Error={2}", Location, response.Text));
}
};
}
The method is called every 15 seconds and it fails every second time, not matter how many seconds is between 2 requests.