ErSame
ErSame

Reputation: 21

How to create an access point

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?

Upvotes: 2

Views: 11198

Answers (1)

mvdan
mvdan

Reputation: 536

You can use accesspoint:

WifiApControl apControl = WifiApControl.getInstance(context);

apControl.enable();

Upvotes: 3

Related Questions