Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.content.*;

import android.net.*;

public class Main {
    public static boolean isWifi(Context context) {
        NetworkInfo networkInfo = ((ConnectivityManager) (context.getSystemService(Context.CONNECTIVITY_SERVICE)))
                .getActiveNetworkInfo();
        return networkInfo != null && networkInfo.isConnected()
                && (networkInfo.getType() == ConnectivityManager.TYPE_WIFI
                        || networkInfo.getType() == ConnectivityManager.TYPE_ETHERNET || networkInfo.getType() == 17
                        || networkInfo.getType() == -1 || networkInfo.getType() == 13
                        || networkInfo.getType() == 16);
    }
}