WifiManager.AddNetworkSuggestions(IList<WifiNetworkSuggestion>) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provide a list of network suggestions to the device.
[Android.Runtime.Register("addNetworkSuggestions", "(Ljava/util/List;)I", "GetAddNetworkSuggestions_Ljava_util_List_Handler", ApiSince=29)]
[Android.Runtime.RequiresPermission("android.permission.CHANGE_WIFI_STATE")]
public virtual Android.Net.Wifi.NetworkStatus AddNetworkSuggestions (System.Collections.Generic.IList<Android.Net.Wifi.WifiNetworkSuggestion> networkSuggestions);
[<Android.Runtime.Register("addNetworkSuggestions", "(Ljava/util/List;)I", "GetAddNetworkSuggestions_Ljava_util_List_Handler", ApiSince=29)>]
[<Android.Runtime.RequiresPermission("android.permission.CHANGE_WIFI_STATE")>]
abstract member AddNetworkSuggestions : System.Collections.Generic.IList<Android.Net.Wifi.WifiNetworkSuggestion> -> Android.Net.Wifi.NetworkStatus
override this.AddNetworkSuggestions : System.Collections.Generic.IList<Android.Net.Wifi.WifiNetworkSuggestion> -> Android.Net.Wifi.NetworkStatus
Parameters
- networkSuggestions
- IList<WifiNetworkSuggestion>
List of network suggestions provided by the app.
Returns
Status code for the operation. One of the STATUS_NETWORK_SUGGESTIONS_ values.
- Attributes
Remarks
Provide a list of network suggestions to the device. See WifiNetworkSuggestion
for a detailed explanation of the parameters. When the device decides to connect to one of the provided network suggestions, platform sends a directed broadcast #ACTION_WIFI_NETWORK_SUGGESTION_POST_CONNECTION
to the app if the network was created with WifiNetworkSuggestion.Builder#setIsAppInteractionRequired(boolean)
flag set and the app holds android.Manifest.permission#ACCESS_FINE_LOCATION ACCESS_FINE_LOCATION
permission.
NOTE: <ul> <li> These networks are just a suggestion to the platform. The platform will ultimately decide on which network the device connects to. </li> <li> When an app is uninstalled or disabled, all its suggested networks are discarded. If the device is currently connected to a suggested network which is being removed then the device will disconnect from that network.</li> <li> If user reset network settings, all added suggestions will be discarded. Apps can use #getNetworkSuggestions()
to check if their suggestions are in the device.</li> <li> In-place modification of existing suggestions are allowed.</li> <ul> <li> If the provided suggestions include any previously provided suggestions by the app, previous suggestions will be updated.</li> <li>If one of the provided suggestions marks a previously unmetered suggestion as metered and the device is currently connected to that suggested network, then the device will disconnect from that network. The system will immediately re-evaluate all the network candidates and possibly reconnect back to the same suggestion. This disconnect is to make sure that any traffic flowing over unmetered networks isn't accidentally continued over a metered network. </li> <li> On android.os.Build.VERSION_CODES#TIRAMISU
or above If one of the provided suggestions marks a previously trusted suggestion as untrusted and the device is currently connected to that suggested network, then the device will disconnect from that network. The system will immediately re-evaluate all the network candidates. This disconnect is to make sure device will not remain connected to an untrusted network without a related android.net.NetworkRequest
. </li> </ul> </ul>
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.