Android M:无法以编程方式删除 WIFI AP [英] Android M: Unable to remove WIFI AP programmatically

查看:30
本文介绍了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

这篇关于Android M:无法以编程方式删除 WIFI AP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆