Share via


WiFiOnDemandHotspotNetwork Class

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.

Represents a device that supports on-demand hotspot. The app registers that device with the operating system (OS), where the app can remotely enable the mobile hotspot. By updating properties on this object, the app can signal to the OS to update the user interface (UI). The object is keyed on a caller-chosen globally-unique identifier (GUID) that is intended to identify the device (the Id property).

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 ref class WiFiOnDemandHotspotNetwork sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 983040)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class WiFiOnDemandHotspotNetwork final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 983040)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class WiFiOnDemandHotspotNetwork
Public NotInheritable Class WiFiOnDemandHotspotNetwork
Inheritance
Object Platform::Object IInspectable WiFiOnDemandHotspotNetwork
Attributes

Windows requirements

Device family
Windows 11 Insider Preview (introduced in 10.0.23504.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v15.0)
App capabilities
onDemandHotspotControl

Examples

On-Demand Hotspot Sample

Remarks

On-demand hotspot is the feature in Windows that allows a the Windows client device to view and remotely enable the mobile hotspot/internet sharing access point on a host Windows device (either a PC or a phone), and connect to it. That allows the client device to share the internet connection of the host device. This functionality is exposed to the user by injecting a Wi-Fi network into the client's network list when the user opens the Wi-Fi Quick Settings or Wi-Fi System Settings available networks (Windows 11).

The app is responsible for determining how to communicate with the hotspot to get the metadata, outside of this API.

Properties

Id

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.

A caller-chosen globally-unique identifier (GUID) that is intended to identify the hotspot.

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.

Methods

GetOrCreateById(Guid)

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.

GetProperties()

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.

Retrieves from a WiFiOnDemandHotspotNetwork object various properties of the hotspot network, such as battery percentage, display name, availability, and SSID/password.

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.

UpdateProperties(WiFiOnDemandHotspotNetworkProperties)

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.

Sets on a WiFiOnDemandHotspotNetwork object various properties of the hotspot network, such as battery percentage, display name, availability, and SSID/password. If any property is invalid, UpdateProperties throws an invalid argument exception.

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.

Applies to

See also

  • <xref:%0a%0a-+%5bWiFiOnDemandHotspotUpdateMetadataTrigger%5d(%2fuwp%2fapi%2fwindows.applicationmodel.background.wifiondemandhotspotupdatemetadatatrigger)%0a-+%5bWiFiOnDemandHotspotConnectTrigger%5d(%2fuwp%2fapi%2fwindows.applicationmodel.background.wifiondemandhotspotconnecttrigger)>