发射打开wifi

WifiManager wifiManager = (WifiManager) getBaseContext()
            .getSystemService(Context.WIFI_SERVICE);
          wifiManager.setWifiEnabled(false);
try {
    wifiManager.getClass()
            .getMethod("setWifiApEnabled",
                               WifiConfiguration.class,
                               boolean.class)
        .invoke(wifiManager, null, false);
} catch (Exception e) {
    Log.e(Main.TAG, "Cannot call: setWifiApEnabled", e);
}

猜你喜欢

转载自wang-peng1.iteye.com/blog/2173463