Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.99 KB | None | 0 0
  1. public class UrlPinger extends AsyncTask<URL, Void, Void> {
  2.  
  3. @Override
  4. protected Void doInBackground(URL... urls) {
  5. URL url = urls[0];
  6.  
  7. try {
  8. HttpURLConnection urlConnection = (HttpURLConnection) url
  9. .openConnection();
  10. urlConnection.connect();
  11. System.out.println("thisi si wie URL>>>"+url+"");
  12. } catch (IOException e) {
  13. // TODO Auto-generated catch block
  14. e.printStackTrace();
  15. System.out.println("ERROR "+e.getMessage()+"");
  16. }
  17.  
  18. return null;
  19.  
  20. }
  21.  
  22. UrlPinger pinger = new UrlPinger();
  23. pinger.execute(myURL);// this is perfect url copy pase in browser hits
  24.  
  25. 04-11 11:32:09.206: D/StatusBar.NetworkController(1154): refreshViews: Data not connected!! Set no data type icon
  26. 04-11 11:32:09.206: D/StatusBar.NetworkController(1154): refreshViews connected={ wifi } level=4 combinedSignalIconId=0x7f0200c1/com.android.systemui:drawable/stat_sys_wifi_signal_4_fully combinedActivityIconId=0x7f0200b1 mobileLabel=BSNL MOBILE wifiLabel=LeewayxxxxXXXXxxxxXXXX emergencyOnly=false combinedLabel=LeewayxxxxXXXXxxxxXXXX mAirplaneMode=false mDataActivity=0 mPhoneSignalIconId=0x7f0200a7 mDataDirectionIconId=0x0 mDataSignalIconId=0x7f0200a7 mDataTypeIconId=0x0 mNoSimIconId=0x0 mWifiIconId=0x7f0200c1 mBluetoothTetherIconId=0x108076a
  27. 04-11 11:32:09.206: D/StatusBar.NetworkController(1154): changing data overlay icon id to 2130837681
  28. 04-11 11:32:10.657: D/StateMachine(651): handleMessage: E msg.what=131155
  29. 04-11 11:32:10.657: D/StateMachine(651): processMsg: ConnectedState
  30. 04-11 11:32:10.657: D/WifiStateMachine(651): ConnectedState{ what=131155 when=-6ms arg1=1121 }
  31. 04-11 11:32:10.657: D/StateMachine(651): processMsg: L2ConnectedState
  32. 04-11 11:32:10.657: D/WifiStateMachine(651): L2ConnectedState{ what=131155 when=-9ms arg1=1121 }
  33. 04-11 11:32:10.657: I/wpa_supplicant(17672): wlan0: Control interface command 'SIGNAL_POLL'
  34. 04-11 11:32:10.667: D/StateMachine(651): handleMessage: X
  35. 04-11 11:32:11.208: W/SignalStrength(1154): getLTELevel - rsrp:2147483647 snr:2147483647 rsrpIconLevel:-1 snrIconLevel:-1
  36. 04-11 11:32:11.208: W/SignalStrength(1154): getLTELevel - rssi:99 rssiIconLevel:0
  37. 04-11 11:32:11.208: W/SignalStrength(1154): getTdScdmaLevel = 0
  38. 04-11 11:32:11.208: W/SignalStrength(1154): getGsmLevel=4
  39. 04-11 11:32:11.208: W/SignalStrength(1154): getLevel=4
  40. 04-11 11:32:11.208: D/StatusBar.NetworkController(1154): refreshViews: Data not connected!! Set no data type icon
  41. 04-11 11:32:11.208: D/StatusBar.NetworkController(1154): refreshViews connected={ wifi } level=4 combinedSignalIconId=0x7f0200c1/com.android.systemui:drawable/stat_sys_wifi_signal_4_fully combinedActivityIconId=0x0 mobileLabel=BSNL MOBILE wifiLabel=LeewayxxxxXXXXxxxxXXXX emergencyOnly=false combinedLabel=LeewayxxxxXXXXxxxxXXXX mAirplaneMode=false mDataActivity=0 mPhoneSignalIconId=0x7f0200a7 mDataDirectionIconId=0x0 mDataSignalIconId=0x7f0200a7 mDataTypeIconId=0x0 mNoSimIconId=0x0 mWifiIconId=0x7f0200c1 mBluetoothTetherIconId=0x108076a
  42. 04-11 11:32:11.218: D/StatusBar.NetworkController(1154): changing data overlay icon id to 0
  43. 04-11 11:32:13.681: D/StateMachine(651): handleMessage: E msg.what=131155
  44. 04-11 11:32:13.681: D/StateMachine(651): processMsg: ConnectedState
  45. 04-11 11:32:13.681: D/WifiStateMachine(651): ConnectedState{ what=131155 when=-3ms arg1=1121 }
  46. 04-11 11:32:13.681: D/StateMachine(651): processMsg: L2ConnectedState
  47. 04-11 11:32:13.681: D/WifiStateMachine(651): L2ConnectedState{ what=131155 when=-6ms arg1=1121 }
  48. 04-11 11:32:13.681: I/wpa_supplicant(17672): wlan0: Control interface command 'SIGNAL_POLL'
  49. 04-11 11:32:13.691: D/StateMachine(651): handleMessage: X
  50. 04-11 11:32:16.694: D/StateMachine(651): handleMessage: E msg.what=131155
  51. 04-11 11:32:16.694: D/StateMachine(651): processMsg: ConnectedState
  52. 04-11 11:32:16.694: D/WifiStateMachine(651): ConnectedState{ what=131155 when=-5ms arg1=1121 }
  53. 04-11 11:32:16.694: D/StateMachine(651): processMsg: L2ConnectedState
  54. 04-11 11:32:16.694: D/WifiStateMachine(651): L2ConnectedState{ what=131155 when=-7ms arg1=1121 }
  55. 04-11 11:32:16.694: I/wpa_supplicant(17672): wlan0: Control interface command 'SIGNAL_POLL'
  56. 04-11 11:32:16.714: D/StateMachine(651): handleMessage: X
  57. 04-11 11:32:19.707: D/StateMachine(651): handleMessage: E msg.what=131155
  58. 04-11 11:32:19.707: D/StateMachine(651): processMsg: ConnectedState
  59. 04-11 11:32:19.707: D/WifiStateMachine(651): ConnectedState{ what=131155 when=-4ms arg1=1121 }
  60. 04-11 11:32:19.717: D/StateMachine(651): processMsg: L2ConnectedState
  61. 04-11 11:32:19.717: D/WifiStateMachine(651): L2ConnectedState{ what=131155 when=-6ms arg1=1121 }
  62. 04-11 11:32:19.717: I/wpa_supplicant(17672): wlan0: Control interface command 'SIGNAL_POLL'
  63. 04-11 11:32:19.727: D/StateMachine(651): handleMessage: X
  64. 04-11 11:32:22.730: D/StateMachine(651): handleMessage: E msg.what=131155
  65. 04-11 11:32:22.730: D/StateMachine(651): processMsg: ConnectedState
  66. 04-11 11:32:22.730: D/WifiStateMachine(651): ConnectedState{ what=131155 when=-5ms arg1=1121 }
  67. 04-11 11:32:22.730: D/StateMachine(651): processMsg: L2ConnectedState
  68. 04-11 11:32:22.740: D/WifiStateMachine(651): L2ConnectedState{ what=131155 when=-6ms arg1=1121 }
  69. 04-11 11:32:22.740: I/wpa_supplicant(17672): wlan0: Control interface command 'SIGNAL_POLL'
  70. 04-11 11:32:22.750: D/StateMachine(651): handleMessage: X
  71.  
  72. HttpURLConnection connection = null;
  73. try {
  74. URL u = new URL("http://www.google.com/");
  75. connection = (HttpURLConnection) u.openConnection();
  76. connection.setRequestMethod("HEAD");
  77. int code = connection.getResponseCode();
  78. System.out.println("" + code);
  79. // You can determine on HTTP return code received. 200 is success.
  80. } catch (MalformedURLException e) {
  81. // TODO Auto-generated catch block
  82. e.printStackTrace();
  83. } catch (IOException e) {
  84. // TODO Auto-generated catch block
  85. e.printStackTrace();
  86. } finally {
  87. if (connection != null) {
  88. connection.disconnect();
  89. }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement