Commit d3f3ab850e64167de61c10c27fee180477993153

Authored by Imanol-Mikel Barba Sabariego
1 parent 11ecfb03

--no commit message

src/com/upc/pbe/upcnews/MainActivity.java
@@ -41,18 +41,21 @@ public class MainActivity extends Activity implements OnClickListener { @@ -41,18 +41,21 @@ public class MainActivity extends Activity implements OnClickListener {
41 new Thread() { 41 new Thread() {
42 public void run() { 42 public void run() {
43 //Wifi Info 43 //Wifi Info
  44 + int speed = 0;
44 for (int i = 0; i < 5; i++) { 45 for (int i = 0; i < 5; i++) {
45 wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); 46 wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
46 WifiInfo info = wifi.getConnectionInfo(); 47 WifiInfo info = wifi.getConnectionInfo();
47 - int speed = info.getLinkSpeed();  
48 - String str = "Speed: " + speed;  
49 - Log.d(TAG, str); 48 + speed = speed + info.getLinkSpeed();
50 try { 49 try {
51 Thread.sleep(1000); 50 Thread.sleep(1000);
52 } catch (InterruptedException e) { 51 } catch (InterruptedException e) {
53 e.printStackTrace(); 52 e.printStackTrace();
54 } 53 }
  54 +
55 } 55 }
  56 +
  57 + String str = "Speed: " + speed/5;
  58 + Log.d(TAG, str);
56 } 59 }
57 }.start(); 60 }.start();
58 61