Back to project page hts-cycle.
The source code is released under:
GNU General Public License
If you think the Android project hts-cycle listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package it.uniroma2.wifionoff; /*from ww w . jav a2 s . co m*/ import android.net.wifi.WifiManager; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; /** * This class wraps WifiManager to provide access to the new Ad-hoc methods thru * reflection, until the API is made official. */ public class WifiManagerNew { private final WifiManager wifiManager; private Class<?> wc; public WifiManagerNew(WifiManager wm) { wifiManager = wm; wc = wm.getClass(); } public boolean isIbssSupported() { try { Method m = wc.getMethod("isIbssSupported", (Class[]) null); Object ret = m.invoke(wifiManager, (Object[]) null); return (Boolean) ret; /* if this method does not exist, IBSS mode is also not supported */ } catch (NoSuchMethodException e) { return false; } catch (IllegalArgumentException e) { return false; } catch (IllegalAccessException e) { return false; } catch (InvocationTargetException e) { return false; } } }