Android Open Source - UTMShuttleAndroid Network Helper






From Project

Back to project page UTMShuttleAndroid.

License

The source code is released under:

GNU General Public License

If you think the Android project UTMShuttleAndroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package util;
//w  w w .j  a v  a2 s.c o m

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

public class NetworkHelper {

    /**
     * Checks if there's an Internet connection and returns true iff there is.
     *
     * @return True iff there is an Internet connection available.
     */
    public static boolean isNetworkAvailable(Context context) {
        if (context != null) {
            ConnectivityManager connectivityManager
                    = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
            NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();

            return activeNetworkInfo != null && activeNetworkInfo.isConnected();
        }

        return false;
    }

}




Java Source Code List

activities.MainActivity.java
adapters.TimesListAdapter.java
async.NoticesTask.java
async.RoutesTask.java
classes.Route.java
classes.Routes.java
global.App.java
util.NetworkHelper.java
util.Scraper.java