2

我想创建一个可以创建接入点的应用程序。查看 Android 文档,我看到了 WifiManager 类 [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;
        }
    }

但由于某种原因,它被隐藏了。有没有办法和 WifiManager 一样?我可以以某种方式访问​​此方法吗?

4

1 回答 1

3

您可以使用接入点

WifiApControl apControl = WifiApControl.getInstance(context);

apControl.enable();
于 2015-09-10T21:40:48.040 回答