i make this code using C Sharp to send the data to the server. it works on the unity simulator but didnt work on android device. im using nexus S and nexus one. Is there any problem with my code? it works on unity 3.0 but in unity 3.3(trail version) it didnt work anymore.
using UnityEngine;
using System.Collections;
public class SendDetails : MonoBehaviour {
public string url = "test url";
public string key = "test key";
public string urlCheck = "test url";
[HideInInspector]
public bool sent = false;
public bool loading = false;
public void SumUpData(string name, string ic, string contact, int score, int level, float height)
{
loading=true;
WWWForm form = new WWWForm();
form.AddField("key", key);
form.AddField("ic", ic);
form.AddField("username", name);
form.AddField("contact", contact);
form.AddField("score", score.ToString());
form.AddField("level", level.ToString());
form.AddField("height", height.ToString());
WWW www = new WWW(url, form);
StartCoroutine(WaitForRequest(www));
}
public void checkInternet()
{
WWW www = new WWW(url);
StartCoroutine(WaitForRequest(www));
}
IEnumerator WaitForRequest(WWW www)
{
yield return www;
if (www.error == null)
{
Debug.Log("WWW Ok!: " + www.text);
loading=false;
sent = true;
}
else
{
Debug.Log("WWW Error: "+ www.error);
loading=false;
sent = false;
}
}
}