How to create an access point

ErSame picture ErSame · Apr 4, 2011 · Viewed 10.2k times · Source

I would like to create an application which could create an access point. Looking through Android documentation I see the WifiManager class [1]:

/**
     * Start AccessPoint mode with the specified
     * configuration. If the radio is already running in
     * AP mode, update the new configuration
     * Note that starting in access point mode disables station
     * mode operation
     * @param wifiConfig SSID, security and channel details as
     *        part of WifiConfiguration
     * @return {@code true} if the operation succeeds, {@code false} otherwise
     *
     * @hide Dont open up yet
     */
    public boolean setWifiApEnabled(WifiConfiguration wifiConfig, boolean enabled) {
        try {
            return mService.setWifiApEnabled(wifiConfig, enabled);
        } catch (RemoteException e) {
            return false;
        }
    }

But because of some reason it is hidden. Is there any way to do the same that WifiManager? Could I have access to this method somehow?

Answer

Daniel Martí picture Daniel Martí · Sep 10, 2015

You can use accesspoint:

WifiApControl apControl = WifiApControl.getInstance(context);

apControl.enable();