Share via


WiFiOnDemandHotspotNetwork.GetOrCreateById(Guid) Method

Definition

Note

Some information relates to pre-released product, which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Important

This API will be affected by upcoming changes to operating system behavior, planned for fall 2024. For more info, see Changes to API behavior for Wi-Fi access and location.

If the operating system (OS) is already configured with a hotspot from the calling app, then GetOrCreateById retrieves the WiFiOnDemandHotspotNetwork object that corresponds to the given networkId. Otherwise, the method creates a new network for that id.

Note

If you want to use this API in a UWP app, and publish your app to the Microsoft Store, then you'll need to request special approval to use the custom capability Microsoft.onDemandHotspotControl_8wekyb3d8bbwe (the On-Demand Network capability). For more info, see Custom capabilities.

The On-Demand Network capability will be made available only to app developers building end-to-end Wi-Fi hotspot scenarios between a tethering-capable hardware device and a Windows PC.

public:
 static WiFiOnDemandHotspotNetwork ^ GetOrCreateById(Platform::Guid networkId);
 static WiFiOnDemandHotspotNetwork GetOrCreateById(winrt::guid const& networkId);
public static WiFiOnDemandHotspotNetwork GetOrCreateById(Guid networkId);
function getOrCreateById(networkId)
Public Shared Function GetOrCreateById (networkId As Guid) As WiFiOnDemandHotspotNetwork

Parameters

networkId
Guid

Platform::Guid

winrt::guid

The globally-unique identifier (GUID) that identifies a WiFiOnDemandHotspotNetwork object.

Returns

The object that was created or retrieved.

Windows requirements

App capabilities
onDemandHotspotControl

Remarks

  • The Id can be any value the app chooses to use to distinguish multiple on-demand hotspots. However, for best performance with ephemeral connections, we recommend reusing the same Id and updating the SSID and Password instead of creating new networks for each one.
  • The Id need only be unique within an app.
  • The calling app must have package identity.

Applies to