/* * Copyright (c) 2013 Denis Solonenko. * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Public License v2.0 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html */ package ru.orangesoftware.financisto2.utils; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; /** * Created with IntelliJ IDEA. * User: dsolonenko * Date: 9/13/13 * Time: 1:33 AM */ public class NetworkUtils { public static boolean isOnline(Context context) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = cm.getActiveNetworkInfo(); return networkInfo != null && networkInfo.isAvailable() && networkInfo.isConnectedOrConnecting(); } }