summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlado <herrlado@gmail.com>2011-11-06 23:43:59 +0100
committerlado <herrlado@gmail.com>2011-11-06 23:43:59 +0100
commita4e3ab13a1ff628715325d15f56ed5043ccf482d (patch)
tree57516942be9023b28f54c542daab425d87173e59
parent2a6d9eecc53461abc4d6313995640cb9c6384c0a (diff)
downloadvdr-manager-a4e3ab13a1ff628715325d15f56ed5043ccf482d.tar.gz
vdr-manager-a4e3ab13a1ff628715325d15f56ed5043ccf482d.tar.bz2
connection check
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java
index b2bb144..9e6ed41 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java
@@ -12,6 +12,7 @@ import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Color;
+import android.net.ConnectivityManager;
import android.net.Uri;
import android.text.Spannable;
import android.text.SpannableString;
@@ -238,5 +239,16 @@ public class Utils {
}
return pi;
}
+
+ public static boolean checkInternetConnection(Context ctx) {
+ ConnectivityManager cm = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE);
+ // test for connection
+ if (cm.getActiveNetworkInfo() != null
+ && cm.getActiveNetworkInfo().isAvailable()
+ && cm.getActiveNetworkInfo().isConnected()) {
+ return true;
+ }
+ return false;
+ }
}