Why TRESTRequest Execute fail with Timeout Exception on android device?

  

I have build a firemonkey app to runs on android device but i have some issues with the Execute procedure of TRESTRequest Class sometimes randomnly fails with java.net.SocketTimeoutException.
I’ve noticed that when I have the wifi enabled the RESTRequest1.Execute is always working correctly but
on the other hand when i enable the Internet Data on the phone, i often get java.net.SocketTimeoutException.
Why is there a difference between Wifi and Internet Data connection?

I tried with ExecuteAsync fuction but i had the same result.

procedure TForm1.Button1Click(Sender: TObject);
begin
RESTResponseDataSetAdapter1.Active := false;
Label1.Visible := false;
Application.ProcessMessages;
RESTRequest1.Resource := ‘customer’;
try
RESTRequest1.Execute; // java.net.SocketTimeoutException
except
Showmessage(‘FAIL’);
end;
RESTResponseDataSetAdapter1.Active := true;
Label1.Visible := true;
end;

Comments are closed.