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 Windows Store 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 : IUssdSessionpublic sealed class UssdSession : IUssdSessionPublic NotInheritable Class UssdSession Implements IUssdSession// You can use this class in JavaScript.
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)

Methods

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

Closes the USSD session with the network.

Note

This functionality is only available to mobile operator apps and Windows Store 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// You can use this method in JavaScript.

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 Windows Store 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// You can use this method in JavaScript.
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.

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 Windows Store 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// You can use this method in JavaScript.
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.

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 Windows Store 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 )// You can use this method in JavaScript.
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.

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);