WifiManager wifiManager = (WifiManager) context.getSystemService(context.WIFI_SERVICE); Method[] methods = wifiManager.getClass().getDeclaredMethods(); boolean enabled=false; for (Method method : methods) { if (method.getName().equals("isWifiApEnabled")) { try { enabled = (Boolean) method.invoke(wifiManager); } catch (Exception ex) { } break; } } for (Method method : methods) { if (method.getName().equals("setWifiApEnabled")) { try { method.invoke(wifiManager, null, !enabled); } catch (Exception ex) { } break; } }
android.permission.CHANGE_WIFI_STATE