Question by
Vorisaj · May 16, 2020 at 07:50 PM ·
androidnetworking
UnityWebRequest.Get - Android - Connection Timed Out
Hey everybody!
I am trying to get data from my server like this:
public IEnumerator downloadTrackOfDay()
{
UnityWebRequest www = UnityWebRequest.Get(Hostname + "/index.php?action=trackoftheday");
yield return www.SendWebRequest();
if (www.isNetworkError || www.isHttpError)
{
Debug.Log("=====AAA======= is Network error : " + www.isNetworkError);
Debug.Log("====AAA======= is HTTP error : " + www.isHttpError);
Debug.Log("====AAA======= error : " + www.error);
Debug.Log(www.error);
UIManager.instance.ShowPopUp("Connection Error.");
} else
{
string[] splitted = www.downloadHandler.text.Split(':');
for(int i = 0; i < 10; i++)
{
trackOfTheDayStats[i] = int.Parse(splitted[i]);
}
trackOfTheDayReady = true;
}
}
It is working fine on the PC in the Unity, but when I build it for Android it is failing on Connection Timed Out. If I copy and paste that URL into the browser in the Android, it also works fine.
In the logcat I can see only:
Curl error 7: Failed to connect to xxx.xx port 443: Connection timed out
Any suggestion what can be the issue? If it is working fine on PC and that URL is working fine in the Android browser?
Thank you!
Comment