Java tutorial
//package com.java2s; import android.content.Context; import android.telephony.TelephonyManager; import java.lang.reflect.Method; public class Main { public static boolean getDataEnabled(Context context) { try { TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); Method getMobileDataEnabledMethod = tm.getClass().getDeclaredMethod("getDataEnabled"); if (null != getMobileDataEnabledMethod) { return (boolean) getMobileDataEnabledMethod.invoke(tm); } } catch (Exception e) { e.printStackTrace(); } return false; } }