UssdSession UssdSession UssdSession UssdSession Class

Definition

Represents a session of the USSD network protocol.

Note

This functionality is only available to mobile operator apps and UWP apps given privileged access by mobile network operators.

If you want to use this API and publish your app to the Store, you will need special approval. For more information, see the Special and restricted capabilities section under App capability declarations.

public : sealed class UssdSession : IUssdSession
public sealed class UssdSession : IUssdSession
Public NotInheritable Class UssdSession Implements IUssdSession
// This class does not provide a public constructor.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
cellularDeviceControl cellularDeviceIdentity

Methods

Close() Close() Close() Close()

Closes the USSD session with the network.

Note

This functionality is only available to mobile operator apps and UWP apps given privileged access by mobile network operators.

If you want to use this API and publish your app to the Store, you will need special approval. For more information, see the Special and restricted capabilities section under App capability declarations.

public : void Close()
public void Close()
Public Function Close() As void
ussdSession.close();
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
cellularDeviceControl cellularDeviceIdentity

CreateFromNetworkAccountId(String) CreateFromNetworkAccountId(String) CreateFromNetworkAccountId(String) CreateFromNetworkAccountId(String)

Creates a USSD session for the mobile device associated with the supplied network account ID.

Note

This functionality is only available to mobile operator apps and UWP apps given privileged access by mobile network operators.

If you want to use this API and publish your app to the Store, you will need special approval. For more information, see the Special and restricted capabilities section under App capability declarations.

public : static UssdSession CreateFromNetworkAccountId(Platform::String networkAccountId)
public static UssdSession CreateFromNetworkAccountId(String networkAccountId)
Public Static Function CreateFromNetworkAccountId(networkAccountId As String) As UssdSession
var ussdSession = Windows.Networking.NetworkOperators.UssdSession.createFromNetworkAccountId(networkAccountId);
Parameters
networkAccountId
Platform::String String String String

The network account ID to use to select the corresponding mobile broadband device to use for the USSD session.

Returns

The USSD session for the mobile device associated with the supplied network account ID.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
cellularDeviceControl cellularDeviceIdentity

CreateFromNetworkInterfaceId(String) CreateFromNetworkInterfaceId(String) CreateFromNetworkInterfaceId(String) CreateFromNetworkInterfaceId(String)

Creates a USSD session for the mobile device associated with the supplied network interface ID.

Note

This functionality is only available to mobile operator apps and UWP apps given privileged access by mobile network operators.

If you want to use this API and publish your app to the Store, you will need special approval. For more information, see the Special and restricted capabilities section under App capability declarations.

public : static UssdSession CreateFromNetworkInterfaceId(Platform::String networkInterfaceId)
public static UssdSession CreateFromNetworkInterfaceId(String networkInterfaceId)
Public Static Function CreateFromNetworkInterfaceId(networkInterfaceId As String) As UssdSession
var ussdSession = Windows.Networking.NetworkOperators.UssdSession.createFromNetworkInterfaceId(networkInterfaceId);
Parameters
networkInterfaceId
Platform::String String String String

The network interface ID to use to select the corresponding mobile broadband device to use for the USSD session.

Returns

The USSD session for the mobile device associated with the supplied network interface ID.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
cellularDeviceControl cellularDeviceIdentity

SendMessageAndGetReplyAsync(UssdMessage) SendMessageAndGetReplyAsync(UssdMessage) SendMessageAndGetReplyAsync(UssdMessage) SendMessageAndGetReplyAsync(UssdMessage)

Sends a message to a USSD session and returns a handler to retrieve the reply asynchronously.

Note

This functionality is only available to mobile operator apps and UWP apps given privileged access by mobile network operators.

If you want to use this API and publish your app to the Store, you will need special approval. For more information, see the Special and restricted capabilities section under App capability declarations.

public : IAsyncOperation<UssdReply> SendMessageAndGetReplyAsync(UssdMessage message)
public IAsyncOperation<UssdReply> SendMessageAndGetReplyAsync(UssdMessage message)
Public Function SendMessageAndGetReplyAsync(message As UssdMessage) As IAsyncOperation( Of UssdReply )
Windows.Networking.NetworkOperators.UssdSession.sendMessageAndGetReplyAsync(message).done( /* Your success and error handlers */ );
Parameters
message
UssdMessage UssdMessage UssdMessage UssdMessage

The message to send to the USSD session.

Returns

An asynchronous handler to retrieve the USSD response to the sent message.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
cellularDeviceControl cellularDeviceIdentity

Remarks

The USSD message being sent can be either a request or a response. The operation is asynchronous and issues a single callback using the IAsyncOperation(UssdReply) interface upon completion. You can cancel the asynchronous operation using the IAsyncOperation(UssdReply) interface.

When an application using the C++ projection of SendMessageAndGetReplyAsync releases its last reference to the UssdSession object from within that callback, SendMessageAndGetReplyAsync may hang. Therefore, applications must ensure that the callback is not released from within SendMessageAndGetReplyAsync. One way of doing this is to create another asynchronous operation (e.g. a timer) from within the callback whose completion callback is used to release the session object by passing it a reference to the session object.

auto timerDelegate = [ussdSession](Windows::System::Threading::ThreadPoolTimer^ timer) {};
Windows::Foundation::TimeSpan delay;
delay.Duration = 1; // non-zero value
Windows::System::Threading::ThreadPoolTimer^ timer = 
Windows::System::Threading::ThreadPoolTimer::CreateTimer(ref new
Windows::System::Threading::TimerElapsedHandler(timerDelegate), delay);