Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can call</p> <p><code>private boolean setWifiApEnabled(WifiConfiguration wifiConfig, boolean enabled);</code></p> <p>using reflection :)</p> <p>after getting the <code>WifiManager</code> use the reflection to get the <code>WifiManager</code> declared methods, look for this method name <code>setWifiApEnabled</code> and invoke it through the <code>WifiManager</code> object</p> <p>These API are marked as @hide, so currently you cannot use them directly, but they appear on the AIDL for the WifiManager so their are accessible!</p> <p>An example can be:</p> <pre><code>WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); Method[] wmMethods = wifi.getClass().getDeclaredMethods(); for(Method method: wmMethods){ if(method.getName().equals("setWifiApEnabled")){ WifiConfiguration netConfig = new WifiConfiguration(); netConfig.SSID = "\"PROVAAP\""; netConfig.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN); netConfig.allowedProtocols.set(WifiConfiguration.Protocol.RSN); netConfig.allowedProtocols.set(WifiConfiguration.Protocol.WPA); netConfig.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK); netConfig.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP); netConfig.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP); netConfig.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP); netConfig.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP); try { method.invoke(wifi, netConfig,true); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } </code></pre> <p>It works but I cannot change the current configuration with my own, and getting the current WifiConfiguration of an active AP drive me to an empty configuration.Why?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload