Bug 730189 - Fix internet connection check. r=rnewman

This commit is contained in:
Chenxia Liu 2012-02-26 13:56:29 -08:00
Родитель 079540f7c6
Коммит c09c734983
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -427,13 +427,13 @@ public class SetupSyncActivity extends AccountAuthenticatorActivity {
private boolean hasInternet() {
Logger.debug(LOG_TAG, "Checking internet connectivity.");
ConnectivityManager connManager = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo wifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
NetworkInfo mobile = connManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
NetworkInfo network = connManager.getActiveNetworkInfo();
if (wifi.isConnected() || mobile.isConnected()) {
Logger.debug(LOG_TAG, "Internet connected.");
if (network != null && network.isConnected()) {
Logger.debug(LOG_TAG, network + " is connected.");
return true;
}
Logger.debug(LOG_TAG, "No connected networks.");
return false;
}