I am working on a multiplayer video game using Unity. I can successfully connect to a remote server using something like this :
public string GetToken(string user, string pass)
{
string uri = _serverUrl + "/Token/" + user + "/" + pass;
UnityWebRequest www = UnityWebRequest.Get(uri);
www.Send();
WaitForSeconds w;
while (!www.isDone)
w = new WaitForSeconds(0.1f);
string token = null;
JObject o = JObject.Parse(www.downloadHandler.text);
token = o.First.First.ToObject<string>();
return token;
}
This works fine when I am trying the code from the Unity Editor on my PC. I can successfully connect to the remote server which is in the WAN.
However when I try to deploy the game on an Android device. The connection fails. (I have been carreful to add the full internet access permission before building the Android apk).
Any idea what might be happening ?
Thanks !