|
@@ -12,23 +12,13 @@ import android.util.Log;
|
|
|
|
|
|
|
|
import com.usai.redant.raimage.RedAntApplication;
|
|
import com.usai.redant.raimage.RedAntApplication;
|
|
|
|
|
|
|
|
-import org.apache.http.HttpEntity;
|
|
|
|
|
-import org.apache.http.HttpResponse;
|
|
|
|
|
-import org.apache.http.HttpStatus;
|
|
|
|
|
import org.apache.http.HttpVersion;
|
|
import org.apache.http.HttpVersion;
|
|
|
import org.apache.http.client.HttpClient;
|
|
import org.apache.http.client.HttpClient;
|
|
|
-import org.apache.http.client.methods.HttpPost;
|
|
|
|
|
import org.apache.http.conn.ClientConnectionManager;
|
|
import org.apache.http.conn.ClientConnectionManager;
|
|
|
-import org.apache.http.conn.ConnectTimeoutException;
|
|
|
|
|
-import org.apache.http.conn.HttpHostConnectException;
|
|
|
|
|
import org.apache.http.conn.scheme.PlainSocketFactory;
|
|
import org.apache.http.conn.scheme.PlainSocketFactory;
|
|
|
import org.apache.http.conn.scheme.Scheme;
|
|
import org.apache.http.conn.scheme.Scheme;
|
|
|
import org.apache.http.conn.scheme.SchemeRegistry;
|
|
import org.apache.http.conn.scheme.SchemeRegistry;
|
|
|
import org.apache.http.conn.ssl.SSLSocketFactory;
|
|
import org.apache.http.conn.ssl.SSLSocketFactory;
|
|
|
-import org.apache.http.entity.mime.HttpMultipartMode;
|
|
|
|
|
-import org.apache.http.entity.mime.MultipartEntity;
|
|
|
|
|
-import org.apache.http.entity.mime.content.FileBody;
|
|
|
|
|
-import org.apache.http.entity.mime.content.StringBody;
|
|
|
|
|
import org.apache.http.impl.client.DefaultHttpClient;
|
|
import org.apache.http.impl.client.DefaultHttpClient;
|
|
|
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
|
|
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
|
|
|
import org.apache.http.params.BasicHttpParams;
|
|
import org.apache.http.params.BasicHttpParams;
|
|
@@ -54,10 +44,8 @@ import java.net.HttpURLConnection;
|
|
|
import java.net.MalformedURLException;
|
|
import java.net.MalformedURLException;
|
|
|
import java.net.ProtocolException;
|
|
import java.net.ProtocolException;
|
|
|
import java.net.Socket;
|
|
import java.net.Socket;
|
|
|
-import java.net.SocketTimeoutException;
|
|
|
|
|
import java.net.URL;
|
|
import java.net.URL;
|
|
|
import java.net.URLEncoder;
|
|
import java.net.URLEncoder;
|
|
|
-import java.net.UnknownHostException;
|
|
|
|
|
import java.security.KeyManagementException;
|
|
import java.security.KeyManagementException;
|
|
|
import java.security.KeyStore;
|
|
import java.security.KeyStore;
|
|
|
import java.security.KeyStoreException;
|
|
import java.security.KeyStoreException;
|
|
@@ -366,191 +354,6 @@ public class Network
|
|
|
}
|
|
}
|
|
|
return ret;
|
|
return ret;
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
- @Deprecated
|
|
|
|
|
- public static String getJson_d(String url, Bundle parms)
|
|
|
|
|
- {
|
|
|
|
|
- String TAG = "net_dbg@GetJson";
|
|
|
|
|
- Log.d(TAG, "entry");
|
|
|
|
|
-
|
|
|
|
|
- // parms.putString("sessionid",
|
|
|
|
|
- // ApexTrackingApplication.get_sessionid());
|
|
|
|
|
-
|
|
|
|
|
- // if (true)
|
|
|
|
|
- // return fakegetJson(url);
|
|
|
|
|
- try
|
|
|
|
|
- {
|
|
|
|
|
- // BasicHttpParams httpParams = new BasicHttpParams();
|
|
|
|
|
- // HttpConnectionParams.setConnectionTimeout(httpParams,
|
|
|
|
|
- // REQUEST_TIMEOUT);
|
|
|
|
|
- // HttpConnectionParams.setSoTimeout(httpParams, SO_TIMEOUT);
|
|
|
|
|
- HttpClient client = getNewHttpClient();// new
|
|
|
|
|
- // DefaultHttpClient(httpParams);
|
|
|
|
|
- HttpPost post = new HttpPost(url);
|
|
|
|
|
- MultipartEntity reqEntity = new MultipartEntity(
|
|
|
|
|
- HttpMultipartMode.BROWSER_COMPATIBLE);
|
|
|
|
|
-
|
|
|
|
|
- Set<String> keys = parms.keySet();
|
|
|
|
|
- Log.d(TAG, "================parms============");
|
|
|
|
|
- for (String key : keys)
|
|
|
|
|
- {
|
|
|
|
|
- if (key.contains("_file"))
|
|
|
|
|
- {
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- reqEntity.addPart(key, new StringBody(parms.get(key)
|
|
|
|
|
- .toString()));
|
|
|
|
|
- Log.d(TAG, "key=" + key + " val="
|
|
|
|
|
- + parms.get(key).toString());
|
|
|
|
|
- }
|
|
|
|
|
- Log.d(TAG, "================parms============");
|
|
|
|
|
-
|
|
|
|
|
- post.setEntity(reqEntity);
|
|
|
|
|
- HttpResponse response = client.execute(post);
|
|
|
|
|
- int statucode = response.getStatusLine().getStatusCode();
|
|
|
|
|
- if (statucode == HttpStatus.SC_OK)
|
|
|
|
|
- {
|
|
|
|
|
- HttpEntity resEntity = response.getEntity();
|
|
|
|
|
- if (resEntity != null)
|
|
|
|
|
- {
|
|
|
|
|
- Log.d(TAG,
|
|
|
|
|
- "Response: content len==>"
|
|
|
|
|
- + resEntity.getContentLength());
|
|
|
|
|
- InputStream is = resEntity.getContent();
|
|
|
|
|
- try
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
- BufferedReader br = new BufferedReader(
|
|
|
|
|
- new InputStreamReader(is, "utf-8"), 8);
|
|
|
|
|
- StringBuilder sb = new StringBuilder();
|
|
|
|
|
- String line = null;
|
|
|
|
|
- while ((line = br.readLine()) != null)
|
|
|
|
|
- {
|
|
|
|
|
- sb.append(line + "\n");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- Log.d(TAG, "Response: content begin");
|
|
|
|
|
- Log.d(TAG, sb.toString());
|
|
|
|
|
- Log.d(TAG, "Response: content end");
|
|
|
|
|
-
|
|
|
|
|
- if (sb.length() <= 0)
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
- return null;
|
|
|
|
|
- }
|
|
|
|
|
- return sb.toString();
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- catch (Exception e)
|
|
|
|
|
- {
|
|
|
|
|
- dbgUtil.fileLog(e.toString());
|
|
|
|
|
- Log.e(TAG, e.toString());
|
|
|
|
|
- return null;
|
|
|
|
|
- // TODO: handle exception
|
|
|
|
|
- }
|
|
|
|
|
- finally
|
|
|
|
|
- {
|
|
|
|
|
- is.close();
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- /*
|
|
|
|
|
- * resEntity is null
|
|
|
|
|
- */
|
|
|
|
|
- Log.d(TAG, "RESPONSE ENTITY IS NULL");
|
|
|
|
|
- return null;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- /*
|
|
|
|
|
- * Http error; out put error code;
|
|
|
|
|
- */
|
|
|
|
|
- Log.d(TAG, "HTTP " + statucode);
|
|
|
|
|
-
|
|
|
|
|
- HttpEntity resEntity = response.getEntity();
|
|
|
|
|
- if (resEntity != null)
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
- InputStream is = resEntity.getContent();
|
|
|
|
|
- try
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
- BufferedReader br = new BufferedReader(
|
|
|
|
|
- new InputStreamReader(is, "utf-8"), 8);
|
|
|
|
|
- StringBuilder sb = new StringBuilder();
|
|
|
|
|
- String line = null;
|
|
|
|
|
- while ((line = br.readLine()) != null)
|
|
|
|
|
- {
|
|
|
|
|
- sb.append(line + "\n");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- Log.d(TAG, "Response: content begin");
|
|
|
|
|
- Log.d(TAG, sb.toString());
|
|
|
|
|
- Log.d(TAG, "Response: content end");
|
|
|
|
|
- return null;
|
|
|
|
|
- }
|
|
|
|
|
- catch (Exception e)
|
|
|
|
|
- {
|
|
|
|
|
- dbgUtil.fileLog(e.toString());
|
|
|
|
|
- Log.e(TAG, e.toString());
|
|
|
|
|
- return null;
|
|
|
|
|
- // TODO: handle exception
|
|
|
|
|
- }
|
|
|
|
|
- finally
|
|
|
|
|
- {
|
|
|
|
|
- is.close();
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- /*
|
|
|
|
|
- * resEntity is null
|
|
|
|
|
- */
|
|
|
|
|
- Log.e(TAG, "RESPONSE ENTITY IS NULL");
|
|
|
|
|
- return null;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- catch (ConnectTimeoutException e)
|
|
|
|
|
- {
|
|
|
|
|
- Log.d(TAG, "request time out");
|
|
|
|
|
- dbgUtil.fileLog(e.toString());
|
|
|
|
|
- return null;
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- catch (SocketTimeoutException e)
|
|
|
|
|
- {
|
|
|
|
|
- Log.d(TAG, "socket time out");
|
|
|
|
|
- dbgUtil.fileLog(e.toString());
|
|
|
|
|
- return null;
|
|
|
|
|
- }
|
|
|
|
|
- catch (UnknownHostException e)
|
|
|
|
|
- {
|
|
|
|
|
- Log.d(TAG, e.toString());
|
|
|
|
|
- dbgUtil.fileLog(e.toString());
|
|
|
|
|
- return null;
|
|
|
|
|
- }
|
|
|
|
|
- catch (HttpHostConnectException e)
|
|
|
|
|
- {
|
|
|
|
|
- Log.d(TAG, e.toString());
|
|
|
|
|
- dbgUtil.fileLog(e.toString());
|
|
|
|
|
- return null;
|
|
|
|
|
- }
|
|
|
|
|
- catch (Exception e)
|
|
|
|
|
- {
|
|
|
|
|
- Log.d(TAG, e.toString());
|
|
|
|
|
- dbgUtil.fileLog(e.toString());
|
|
|
|
|
- return null;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public static boolean NetworkIsAvailable()// Context context)
|
|
public static boolean NetworkIsAvailable()// Context context)
|
|
@@ -1305,257 +1108,7 @@ public class Network
|
|
|
void onFinish(int code, String res/*, HashMap<String, List<String>> headers*/);
|
|
void onFinish(int code, String res/*, HashMap<String, List<String>> headers*/);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Deprecated
|
|
|
|
|
- public static int UploadFiled(String path, String user, String password,
|
|
|
|
|
- String pid,String server)
|
|
|
|
|
- {
|
|
|
|
|
- String TAG = "net_dbg@UploadFile";
|
|
|
|
|
- Log.d(TAG, "entry");
|
|
|
|
|
-
|
|
|
|
|
- Log.d(TAG, "sourcefile:" + path);
|
|
|
|
|
- File file = new File(path);
|
|
|
|
|
-
|
|
|
|
|
- if (file.exists() == false)
|
|
|
|
|
- {
|
|
|
|
|
- dbgUtil.fileLog("file "+ path +" not found!");
|
|
|
|
|
- return RESULT_LOCALFILE_ERROR;
|
|
|
|
|
- }
|
|
|
|
|
- String md5 = MD5.md5sum(path);
|
|
|
|
|
- Log.d(TAG, "MD5:" + md5);
|
|
|
|
|
- if (md5 == null)
|
|
|
|
|
- {
|
|
|
|
|
- Log.d(TAG, "md5 sum failed");
|
|
|
|
|
- dbgUtil.fileLog("md5 sum failed");
|
|
|
|
|
- return RESULT_LOCALFILE_ERROR;
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- try
|
|
|
|
|
- {
|
|
|
|
|
- BasicHttpParams httpParams = new BasicHttpParams();
|
|
|
|
|
- HttpConnectionParams.setConnectionTimeout(httpParams,
|
|
|
|
|
- REQUEST_TIMEOUT);
|
|
|
|
|
- HttpConnectionParams.setSoTimeout(httpParams, SO_TIMEOUT);
|
|
|
|
|
- HttpClient client = new DefaultHttpClient(httpParams);
|
|
|
|
|
- HttpPost post = new HttpPost(server
|
|
|
|
|
- + URL_UPLOAD_PHOTO);
|
|
|
|
|
- MultipartEntity reqEntity = new MultipartEntity(
|
|
|
|
|
- HttpMultipartMode.BROWSER_COMPATIBLE);
|
|
|
|
|
- reqEntity.addPart("user", new StringBody(user));
|
|
|
|
|
- reqEntity.addPart("password", new StringBody(password));
|
|
|
|
|
- reqEntity.addPart("pid", new StringBody(pid));
|
|
|
|
|
- reqEntity.addPart("md5", new StringBody(md5));
|
|
|
|
|
-
|
|
|
|
|
- FileBody bin = new FileBody(file);
|
|
|
|
|
- reqEntity.addPart("imagefile", bin);
|
|
|
|
|
- post.setEntity(reqEntity);
|
|
|
|
|
- HttpResponse response = client.execute(post);
|
|
|
|
|
- int statucode = response.getStatusLine().getStatusCode();
|
|
|
|
|
- if (statucode == HttpStatus.SC_OK)
|
|
|
|
|
- {
|
|
|
|
|
- HttpEntity resEntity = response.getEntity();
|
|
|
|
|
- if (resEntity != null)
|
|
|
|
|
- {
|
|
|
|
|
- Log.d(TAG,
|
|
|
|
|
- "Response: content len==>"
|
|
|
|
|
- + resEntity.getContentLength());
|
|
|
|
|
- InputStream is = resEntity.getContent();
|
|
|
|
|
- try
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
- BufferedReader br = new BufferedReader(
|
|
|
|
|
- new InputStreamReader(is, "utf-8"), 8);
|
|
|
|
|
- StringBuilder sb = new StringBuilder();
|
|
|
|
|
- String line = null;
|
|
|
|
|
- while ((line = br.readLine()) != null)
|
|
|
|
|
- {
|
|
|
|
|
- sb.append(line + "\n");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- Log.d(TAG, "Response: content begin");
|
|
|
|
|
- Log.d(TAG, sb.toString());
|
|
|
|
|
- Log.d(TAG, "Response: content end");
|
|
|
|
|
-
|
|
|
|
|
- if (sb.length() <= 0)
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
- return RESULT_NET_ERROR;
|
|
|
|
|
- }
|
|
|
|
|
- JSONObject obj = new JSONObject(sb.toString());
|
|
|
|
|
- if (obj.length() > 0)
|
|
|
|
|
- {
|
|
|
|
|
- // JSONObject obj = array.getJSONObject(0);
|
|
|
|
|
- try
|
|
|
|
|
- {
|
|
|
|
|
- int uploadresult = Integer.parseInt(obj
|
|
|
|
|
- .getString("result"));
|
|
|
|
|
- if (uploadresult == Network.AP_UPLOAD_SUCCESS)
|
|
|
|
|
- {
|
|
|
|
|
- return RESULT_TRUE;
|
|
|
|
|
- }
|
|
|
|
|
- else if (uploadresult == Network.AP_USER_NOT_AUTH)
|
|
|
|
|
- {
|
|
|
|
|
- Log.d(TAG, "RESULT_ERR_USERAUTH");
|
|
|
|
|
- return RESULT_USERAUTH_ERROR;
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- return RESULT_FALSE;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- catch (Exception e)
|
|
|
|
|
- {
|
|
|
|
|
- Log.e(TAG, e.toString()+1);
|
|
|
|
|
- dbgUtil.fileLog(e.toString());
|
|
|
|
|
- return RESULT_FALSE;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- catch (Exception e)
|
|
|
|
|
- {
|
|
|
|
|
- Log.e(TAG, e.toString());
|
|
|
|
|
- dbgUtil.fileLog(e.toString());
|
|
|
|
|
- return RESULT_NET_ERROR;
|
|
|
|
|
- // TODO: handle exception
|
|
|
|
|
- }
|
|
|
|
|
- finally
|
|
|
|
|
- {
|
|
|
|
|
- is.close();
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- /*
|
|
|
|
|
- * resEntity is null
|
|
|
|
|
- */
|
|
|
|
|
- Log.d(TAG, "RESPONSE ENTITY IS NULL");
|
|
|
|
|
- return RESULT_NET_ERROR;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- /*
|
|
|
|
|
- * Http error; out put error code;
|
|
|
|
|
- */
|
|
|
|
|
- Log.d(TAG, "HTTP " + statucode);
|
|
|
|
|
-
|
|
|
|
|
- HttpEntity resEntity = response.getEntity();
|
|
|
|
|
- if (resEntity != null)
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
- InputStream is = resEntity.getContent();
|
|
|
|
|
- try
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
- BufferedReader br = new BufferedReader(
|
|
|
|
|
- new InputStreamReader(is, "utf-8"), 8);
|
|
|
|
|
- StringBuilder sb = new StringBuilder();
|
|
|
|
|
- String line = null;
|
|
|
|
|
- while ((line = br.readLine()) != null)
|
|
|
|
|
- {
|
|
|
|
|
- sb.append(line + "\n");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- Log.d(TAG, "Response: content begin");
|
|
|
|
|
- Log.d(TAG, sb.toString());
|
|
|
|
|
- Log.d(TAG, "Response: content end");
|
|
|
|
|
- return RESULT_NET_ERROR;
|
|
|
|
|
- }
|
|
|
|
|
- catch (Exception e)
|
|
|
|
|
- {
|
|
|
|
|
- Log.e(TAG, e.toString());
|
|
|
|
|
- dbgUtil.fileLog(e.toString());
|
|
|
|
|
- return RESULT_NET_ERROR;
|
|
|
|
|
-
|
|
|
|
|
- // TODO: handle exception
|
|
|
|
|
- }
|
|
|
|
|
- finally
|
|
|
|
|
- {
|
|
|
|
|
- is.close();
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- /*
|
|
|
|
|
- * resEntity is null
|
|
|
|
|
- */
|
|
|
|
|
- Log.e(TAG, "RESPONSE ENTITY IS NULL");
|
|
|
|
|
- return RESULT_NET_ERROR;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- catch (ConnectTimeoutException e)
|
|
|
|
|
- {
|
|
|
|
|
- Log.d(TAG, "request time out");
|
|
|
|
|
- dbgUtil.fileLog(e.toString());
|
|
|
|
|
- return RESULT_NET_ERROR;
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- catch (SocketTimeoutException e)
|
|
|
|
|
- {
|
|
|
|
|
- Log.d(TAG, "socket time out");
|
|
|
|
|
- dbgUtil.fileLog(e.toString());
|
|
|
|
|
- return RESULT_NET_ERROR;
|
|
|
|
|
- }
|
|
|
|
|
- catch (UnknownHostException e)
|
|
|
|
|
- {
|
|
|
|
|
- Log.d(TAG, e.toString());
|
|
|
|
|
- dbgUtil.fileLog(e.toString());
|
|
|
|
|
- return RESULT_NET_ERROR;
|
|
|
|
|
- }
|
|
|
|
|
- catch (HttpHostConnectException e)
|
|
|
|
|
- {
|
|
|
|
|
- Log.d(TAG, e.toString());
|
|
|
|
|
- dbgUtil.fileLog(e.toString());
|
|
|
|
|
- return RESULT_NET_ERROR;
|
|
|
|
|
- }
|
|
|
|
|
- catch (Exception e)
|
|
|
|
|
- {
|
|
|
|
|
- Log.d(TAG, e.toString()+" RESULT_ERROR!!");
|
|
|
|
|
- dbgUtil.fileLog(e.toString());
|
|
|
|
|
- return RESULT_ERROR;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return RESULT_FALSE;
|
|
|
|
|
-
|
|
|
|
|
- // try
|
|
|
|
|
- // {
|
|
|
|
|
- // HttpClient client = new DefaultHttpClient();
|
|
|
|
|
- // HttpPost post = new HttpPost(url);
|
|
|
|
|
- // MultipartEntity reqEntity = new MultipartEntity(
|
|
|
|
|
- // HttpMultipartMode.BROWSER_COMPATIBLE);
|
|
|
|
|
- // reqEntity.addPart("user", new StringBody(user));
|
|
|
|
|
- // reqEntity.addPart("password", new StringBody(password));
|
|
|
|
|
- // reqEntity.addPart("pid", new StringBody(pid));
|
|
|
|
|
- // FileBody bin = new FileBody(file);
|
|
|
|
|
- // reqEntity.addPart("imagefile", bin);
|
|
|
|
|
- // post.setEntity(reqEntity);
|
|
|
|
|
- // HttpResponse response = client.execute(post);
|
|
|
|
|
- // HttpEntity resEntity = response.getEntity();
|
|
|
|
|
- // if (resEntity != null)
|
|
|
|
|
- // {
|
|
|
|
|
- //
|
|
|
|
|
- // String result = EntityUtils.toString(resEntity);
|
|
|
|
|
- // Log.d(TAG, "Response:" + result);
|
|
|
|
|
- // return Integer.parseInt(result);
|
|
|
|
|
- // // if(Boolean.parseBoolean(result)==true)
|
|
|
|
|
- // // return true;
|
|
|
|
|
- // // else
|
|
|
|
|
- // // return false;
|
|
|
|
|
- // }
|
|
|
|
|
- //
|
|
|
|
|
- // }
|
|
|
|
|
- // catch (Exception e)
|
|
|
|
|
- // {
|
|
|
|
|
- // e.printStackTrace();
|
|
|
|
|
- // }
|
|
|
|
|
- // return 0;
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
public static boolean NetworkIsAvailable(Context context)
|
|
public static boolean NetworkIsAvailable(Context context)
|
|
|
{
|
|
{
|