WifiNetworkSuggestion.Builder.Build 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.
Create a network suggestion object for use in
WifiManager#addNetworkSuggestions(List)
.
[Android.Runtime.Register("build", "()Landroid/net/wifi/WifiNetworkSuggestion;", "", ApiSince=29)]
public Android.Net.Wifi.WifiNetworkSuggestion Build ();
[<Android.Runtime.Register("build", "()Landroid/net/wifi/WifiNetworkSuggestion;", "", ApiSince=29)>]
member this.Build : unit -> Android.Net.Wifi.WifiNetworkSuggestion
Returns
Instance of WifiNetworkSuggestion
- Attributes
Remarks
Create a network suggestion object for use in WifiManager#addNetworkSuggestions(List)
.
<b>Note:</b> Apps can set a combination of SSID using #setSsid(String)
and BSSID using #setBssid(MacAddress)
to provide more fine grained network suggestions to the platform.
For example: To provide credentials for one open, one WPA2, one WPA3 network with their corresponding SSID's and one with Passpoint config:
{@code
final WifiNetworkSuggestion suggestion1 =
new Builder()
.setSsid("test111111")
.build();
final WifiNetworkSuggestion suggestion2 =
new Builder()
.setSsid("test222222")
.setWpa2Passphrase("test123456")
.build();
final WifiNetworkSuggestion suggestion3 =
new Builder()
.setSsid("test333333")
.setWpa3Passphrase("test6789")
.build();
final PasspointConfiguration passpointConfig= new PasspointConfiguration();
// configure passpointConfig to include a valid Passpoint configuration
final WifiNetworkSuggestion suggestion4 =
new Builder()
.setPasspointConfig(passpointConfig)
.build();
final List<WifiNetworkSuggestion> suggestionsList =
new ArrayList<WifiNetworkSuggestion> { {
add(suggestion1);
add(suggestion2);
add(suggestion3);
add(suggestion4);
} };
final WifiManager wifiManager =
context.getSystemService(Context.WIFI_SERVICE);
wifiManager.addNetworkSuggestions(suggestionsList);
// ...
}
Java documentation for android.net.wifi.WifiNetworkSuggestion.Builder.build()
.
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.