Interface IPushNotificationsService
Interface representing a collection of methods to interact with the Push Notifications service.
Namespace: Unity.Services.PushNotifications
Assembly: Unity.Services.PushNotifications.dll
Syntax
public interface IPushNotificationsService
Properties
Analytics
This is no longer required. Notification events are recorded for you automatically when you register for push notifications using RegisterForPushNotificationsAsync().
Declaration
[Obsolete("Do not use this. It will be removed in a future version. Events are recorded for you automatically.")]
IPushNotificationsAnalytics Analytics { get; }
Property Value
Type | Description |
---|---|
IPushNotificationsAnalytics |
Methods
RegisterForPushNotificationsAsync()
Registers for push notifications with the appropriate mechanism for the current platform.
This method will automatically handle platform specific intricacies of getting a push notification token, and will send the appropriate analytics events to Unity Analytics 2.
Declaration
Task<string> RegisterForPushNotificationsAsync()
Returns
Type | Description |
---|---|
Task<string> | (Asynchronously via a Task) The device token as a string. |
Events
OnRemoteNotificationReceived
Subscribe to this event to be notified when a remote notification is used to launch or reopen the app.
You must set up event subscriptions before calling RegisterForPushNotificationsAsync.
If the application was started from a remote notification, this event will be invoked once the RegisterForPushNotificationsAsync process has completed.
Declaration
event Action<Dictionary<string, object>> OnRemoteNotificationReceived
Event Type
Type | Description |
---|---|
Action<Dictionary<string, object>> |