title: How to turn on/off wifi hotspot programmatically in Android 8.0 (Oreo)
body: <p>I know how to turn on/off wifi hot spot using reflection in android using below method.</p>
  
  <pre><code>private static boolean changeWifiHotspotState(Context context,boolean enable) {
          try {
              WifiManager manager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
              Method method = manager.getClass().getDeclaredMethod("setWifiApEnabled", WifiConfiguration.class,
                      Boolean.TYPE);
              method.setAccessible(true);
              WifiConfiguration configuration = enable ? getWifiApConfiguration(manager) : null;
              boolean isSuccess = (Boolean) method.invoke(manager, configuration, enable);
              return isSuccess;
          } catch (Exception e) {
              e.printStackTrace();
          }
          return false;
      }
  </code></pre>
  
  <p><strong>But the above method is not working Android 8.0(Oreo).</strong> <br><br>
  When I execute above method in Android 8.0, I am getting below statement in logcat.</p>
  
  <pre><code>com.gck.dummy W/WifiManager: com.gck.dummy attempted call to setWifiApEnabled: enabled = true
  </code></pre>
  
  <p>Is there any other way to on/off hotspot on android 8.0</p>