зеркало из https://github.com/mozilla/gecko-dev.git
Bug 730189 - Fix internet connection check. r=rnewman
This commit is contained in:
Родитель
079540f7c6
Коммит
c09c734983
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче