Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.net.ConnectivityManager; public class Main { public static int TYPE_WIFI = 1; public static int TYPE_MOBILE = 2; /** * Permet de verifier la connexion tablette est elle en 4 G ou non * @param pContext * @return */ public static boolean isConnectedWithData(Context pContext) { ConnectivityManager connMgr = (ConnectivityManager) pContext.getSystemService(Context.CONNECTIVITY_SERVICE); android.net.NetworkInfo wifi = connMgr.getNetworkInfo(ConnectivityManager.TYPE_WIFI); android.net.NetworkInfo mobile = connMgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE); return mobile.isConnectedOrConnecting(); } }