首页 > 代码库 > Android-向服务器发送信息

Android-向服务器发送信息


public boolean sendPhoneInfo(String path){
URL url = null;
try {
url = new URL(path);
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setConnectTimeout(5000);
conn.setRequestMethod("GET");
if(conn.getResponseCode() == 200){
return true;
}
} catch (Exception e) {
e.printStackTrace();
}

return false;
}
new Thread(){
@Override
public void run(){
App.isSuccess = sendPhoneInfo(path);
Log.d("czDebug",path);
}
}.start();

Android-向服务器发送信息