我想创建一个可以创建接入点的应用程序。浏览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有没有办法做同样的事情?我可以以某种方式访问此方法吗?
答案 0 :(得分:3)
您可以使用accesspoint:
WifiApControl apControl = WifiApControl.getInstance(context);
apControl.enable();
答案 1 :(得分:0)
您也可以尝试this主题中的代码。