Example usage for android.net NetworkInfo isAvailable

List of usage examples for android.net NetworkInfo isAvailable

Introduction

In this page you can find the example usage for android.net NetworkInfo isAvailable.

Prototype

@Deprecated
public boolean isAvailable() 

Source Link

Document

Indicates whether network connectivity is possible.

Usage

From source file:org.brandroid.openmanager.activities.OpenExplorer.java

public boolean isNetworkConnected() {
    ConnectivityManager conman = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
    if (!conman.getBackgroundDataSetting())
        return false;
    NetworkInfo ni = conman.getActiveNetworkInfo();
    if (ni == null)
        return false;
    if (!ni.isAvailable() || !ni.isConnected())
        return false;
    if (ni.getState() == State.CONNECTING)
        return false;
    return true;/*w ww .ja  v a2 s.c o  m*/
}