Commit 625f7d457c59077999b06aec272e56b9913497de
1 parent
71234b1a
Wifi Status added
Showing
3 changed files
with
11 additions
and
1 deletions
AndroidManifest.xml
@@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
8 | android:targetSdkVersion="10" /> | 8 | android:targetSdkVersion="10" /> |
9 | <uses-permission android:name="android.permission.INTERNET"/> | 9 | <uses-permission android:name="android.permission.INTERNET"/> |
10 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | 10 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> |
11 | + <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> | ||
11 | 12 | ||
12 | 13 | ||
13 | <application | 14 | <application |
src/com/upc/pbe/upcnews/MainActivity.java
1 | package com.upc.pbe.upcnews; | 1 | package com.upc.pbe.upcnews; |
2 | 2 | ||
3 | import android.app.Activity; | 3 | import android.app.Activity; |
4 | +import android.content.Context; | ||
4 | import android.content.Intent; | 5 | import android.content.Intent; |
6 | +import android.net.wifi.WifiInfo; | ||
7 | +import android.net.wifi.WifiManager; | ||
5 | import android.os.Bundle; | 8 | import android.os.Bundle; |
6 | import android.util.Log; | 9 | import android.util.Log; |
7 | import android.view.Menu; | 10 | import android.view.Menu; |
@@ -15,6 +18,7 @@ import android.widget.Toast; | @@ -15,6 +18,7 @@ import android.widget.Toast; | ||
15 | public class MainActivity extends Activity implements OnClickListener { | 18 | public class MainActivity extends Activity implements OnClickListener { |
16 | final static String TAG = "Main"; | 19 | final static String TAG = "Main"; |
17 | static String html; | 20 | static String html; |
21 | + WifiManager wifi; | ||
18 | 22 | ||
19 | Directoris dir; | 23 | Directoris dir; |
20 | Button buttonDescarrega; | 24 | Button buttonDescarrega; |
@@ -50,6 +54,11 @@ public class MainActivity extends Activity implements OnClickListener { | @@ -50,6 +54,11 @@ public class MainActivity extends Activity implements OnClickListener { | ||
50 | 54 | ||
51 | public void onClick(View v) { | 55 | public void onClick(View v) { |
52 | Log.d(TAG, "onClicked"); | 56 | Log.d(TAG, "onClicked"); |
57 | + wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); | ||
58 | + WifiInfo info = wifi.getConnectionInfo(); | ||
59 | + int speed = info.getLinkSpeed(); | ||
60 | + String str = "Speed: "+speed; | ||
61 | + Log.d(TAG, str); | ||
53 | this.descarregar(); | 62 | this.descarregar(); |
54 | ((UpcApp) getApplication()).setDesc(html); | 63 | ((UpcApp) getApplication()).setDesc(html); |
55 | startActivity(new Intent(this, Directoris.class)); | 64 | startActivity(new Intent(this, Directoris.class)); |
src/com/upc/pbe/upcnews/UpcApp.java
@@ -11,7 +11,7 @@ public class UpcApp extends Application implements OnSharedPreferenceChangeListe | @@ -11,7 +11,7 @@ public class UpcApp extends Application implements OnSharedPreferenceChangeListe | ||
11 | 11 | ||
12 | final static String TAG = "Application"; | 12 | final static String TAG = "Application"; |
13 | SharedPreferences prefs; | 13 | SharedPreferences prefs; |
14 | - String defaultUrl = "10.0.2.100"; | 14 | + String defaultUrl = "imanolbarba.myftp.biz/PBE"; |
15 | String url = null; | 15 | String url = null; |
16 | String desc; | 16 | String desc; |
17 | 17 |