Guest User

Untitled

a guest
Nov 19th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. try {
  2. URL url = new URL("http://"+params[0]);
  3.  
  4. HttpURLConnection urlc = (HttpURLConnection) url.openConnection();
  5. urlc.setRequestProperty("User-Agent", "Android Application:"+Z.APP_VERSION);
  6. urlc.setRequestProperty("Connection", "close");
  7. urlc.setConnectTimeout(1000 * 30); // mTimeout is in seconds
  8. urlc.connect();
  9.  
  10. if (urlc.getResponseCode() == 200) {
  11. Main.Log("getResponseCode == 200");
  12. return new Boolean(true);
  13. }
  14. } catch (MalformedURLException e1) {
  15. e1.printStackTrace();
  16. } catch (IOException e) {
  17. e.printStackTrace();
  18. }
Add Comment
Please, Sign In to add comment