文件名称:GPRS网络开关
文件大小:23KB
文件格式:ZIP
更新时间:2015-06-18 09:31:38
GPRS开关
可以开启或者关闭android网络, final ConnectivityManager conman = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); final Class conmanClass = Class.forName(conman.getClass().getName()); final Field iConnectivityManagerField = conmanClass.getDeclaredField("mService"); iConnectivityManagerField.setAccessible(true); final Object iConnectivityManager = iConnectivityManagerField.get(conman); final Class iConnectivityManagerClass = Class.forName(iConnectivityManager.getClass().getName()); final Method setMobileDataEnabledMethod = iConnectivityManagerClass.getDeclaredMethod("setMobileDataEnabled", Boolean.TYPE); setMobileDataEnabledMethod.setAccessible(true); setMobileDataEnabledMethod.invoke(iConnectivityManager, enabled);
【文件预览】:
GPRS
----bin()
--------res()
--------jarlist.cache(119B)
--------classes()
----res()
--------drawable-ldpi()
--------drawable-hdpi()
--------values()
--------drawable-mdpi()
--------layout()
----assets()
----gen()
--------com()
----proguard.cfg(1KB)
----.settings()
--------org.eclipse.jdt.core.prefs(177B)
----src()
--------com()
----.project(840B)
----.classpath(364B)
----project.properties(361B)
----AndroidManifest.xml(1KB)