共用方式為


AppNotificationManager.Register Method

Definition

Overloads

Register()

Registers the app to receive NotificationInvoked events when the user interacts with an app notification.

Note

The AppNotificationManager class has a dependency on the Singleton package. Because of that dependency, there are certain considerations to be aware of if you're calling these APIs from a self-contained app. For more info, and specifics, see Dependencies on additional MSIX packages.

Register(String, Uri)

Registers the app to receive NotificationInvoked events when the user interacts with an app notification.

Note

The AppNotificationManager class has a dependency on the Singleton package. Because of that dependency, there are certain considerations to be aware of if you're calling these APIs from a self-contained app. For more info, and specifics, see Dependencies on additional MSIX packages.

Register()

Registers the app to receive NotificationInvoked events when the user interacts with an app notification.

Note

The AppNotificationManager class has a dependency on the Singleton package. Because of that dependency, there are certain considerations to be aware of if you're calling these APIs from a self-contained app. For more info, and specifics, see Dependencies on additional MSIX packages.

public:
 virtual void Register() = Register;
void Register();
public void Register();
function register()
Public Sub Register ()

Remarks

For packaged apps, the COM server is defined in the app manifest. The process calling Register and the process defined in the manifest as the COM server are required to be the same. For unpackaged apps, the calling process will be registered as the COM server and assets like the app display name and icon will be retrieved from the shell and registered as well.

To ensure that the NotificationInvoked event handler is called within the process of the running app, be sure to register the handler for that event before calling Register. Otherwise, a new process will be launched to handle the invocation.

Before your app terminates, call Unregister to clean up resources and ensure that your app is launched for subsequent app notifications.

If you don't intend for your app to use the app notification feature ever again, you should call UnregisterAll in order to clean up the registrations in the system.

See also

Applies to

Register(String, Uri)

Registers the app to receive NotificationInvoked events when the user interacts with an app notification.

Note

The AppNotificationManager class has a dependency on the Singleton package. Because of that dependency, there are certain considerations to be aware of if you're calling these APIs from a self-contained app. For more info, and specifics, see Dependencies on additional MSIX packages.

public:
 virtual void Register(Platform::String ^ displayName, Uri ^ iconUri) = Register;
void Register(winrt::hstring const& displayName, Uri const& iconUri);
public void Register(string displayName, System.Uri iconUri);
function register(displayName, iconUri)
Public Sub Register (displayName As String, iconUri As Uri)

Parameters

displayName
String

Platform::String

winrt::hstring

iconUri
Uri Uri

Applies to