I have an android app that is sending data to GCM and my back end server, which is xampp in my local computer. When WI-FI is on it works like a charm. I get to send data to GCM and my server. But when I use my 3-G data on and turn off the WI-FI it doesn't deliver the data and I get "09-23 13:45:57.165 720-1055/? E/ConnectivityService﹕ net.tcp.usercfg.default not found in system properties. Using defaults 09-23 13:45:57.165 720-1055/? E/ConnectivityService﹕ net.tcp.delack.default not found in system properties." in my stack trace. What is causing this? How do I reslove this?
This the class that sends JSON to the server over 192.168....
class SendJSON extends AsyncTask<String, Void, String> {
boolean failure = false;
@Override
protected String doInBackground(String... args) {
try {
try {
URL url;
HttpURLConnection urlConn;
url = new URL ("http://192.168.*.**/PHPserver/fipage.php");
urlConn = (HttpURLConnection)url.openConnection();
urlConn.setDoInput (true);
urlConn.setDoOutput (true);
urlConn.setUseCaches (false);
urlConn.setRequestProperty("Content-Type","application/json");
urlConn.setRequestProperty("Accept", "application/json");
urlConn.setChunkedStreamingMode(0);
urlConn.setRequestMethod("POST");
urlConn.connect();
//Create JSONObject here
JSONObject json = new JSONObject();
json.put("stuff", String.valueOf(args[0]));
String send=json.toString();
// Send POST output.
OutputStreamWriter os = new OutputStreamWriter(urlConn.getOutputStream(), "UTF-8");
os.write(send);
Log.i("NOTIFICATION", "Data Sent");
os.close();
BufferedReader reader = new BufferedReader(new InputStreamReader(urlConn.getInputStream()));
String msg="";
String line = "";
while ((line = reader.readLine()) != null) {
msg += line; }
Log.i("msg=",""+msg);
} catch (MalformedURLException muex) {
// TODO Auto-generated catch block
muex.printStackTrace();
} catch (IOException ioex){
ioex.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
Log.e("ERROR", "There is error sending");
}
return null;
}
}