Android M:无法以编程方式删除 WIFI AP
在 Android M 中:我使用以下代码删除当前连接的 WIFI AP.
In Android M: I am using below code to remove current connected WIFI AP.
void RemoveConnectedNetwork(){
int ID=_wifiManager.getConnectionInfo().getNetworkId();
Log.d("test", "network id = ["+ID+"]");
boolen ret =_wifiManager.removeNetwork(ID);
Log.d("test", "removeNetwork return ="+ret);
_wifiManager.saveConfiguration();
}
但 RemoveConnectedNetwork()
总是返回 false.
尽管此 API 在以前的版本中运行良好.
Although this API was working well in previous releases.
使用 Android M 中的任何其他 API 可以实现的任何解决方案?
Any solution that can be achieved on this using any other API in Android M?
谢谢.
Android 6.0 中的 Wifi Manager 有一些变化.
There are some changes in the Wifi Manager in Android 6.0.
如果 WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN 为非零,则用户无法再修改或删除由活动设备所有者创建的任何 Wi-Fi 配置.
Any Wi-Fi configuration created by an active Device Owner can no longer be modified or deleted by the user if WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN is non-zero.
用户仍然可以创建和修改自己的 Wi-Fi 配置.
The user can still create and modify their own Wi-Fi configurations.
活动设备所有者有权编辑或删除任何 Wi-Fi 配置,包括不是由他们创建的配置.
Active Device Owners have the privilege of editing or removing any Wi-Fi configurations, including those not created by them.
请参阅此链接了解更多详情:https://developer.android.com/about/versions/棉花糖/android-6.0-changes.html
Please refer to this link for further details: https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html