Skip to end of metadata
Go to start of metadata

Represents a push service manager that handles push service to iOS, Android, WindowsPhone and Windows RT push notification service.

Definition

public class PushServiceManager : IDisposable

Summary

The following table summarizes the members exposed in this class.

Public Constructors

PushServiceManager Constructor() Initializes a new instance of the PushServiceManager class.

Static Properties

Instance Gets the singleton instance.

Static Methods

GetOperatingSystem(string) Gets the operating system.

Public Methods

GetAllRegistrations() Gets all the registered services
GetRegistrations<TNotification>() Gets all the registered services for the given notification type
GetRegistrations(string) Gets all the registered services for the given application identifier
GetRegistrations<TNotification>(string) Gets all the registered services for the given notification type and application identifier
GetRegistrations(Type, string) Gets all the registered services for the given notification type and application identifier
QueueNotification(IEnumerable<IPushToken>, string, string, Dictionary<string, string>) Create and queues all device tokens to all services registered.
QueueNotification(IEnumerable<IPushToken>, string, string, string, Dictionary<string, string>) Create and queues all device tokens to all services registered.
QueueNotification(IPushToken, string, string, Dictionary<string, string>) Create and queues the device token to all services registered for this type of device token.
QueueNotification(IPushToken, string, string, string, Dictionary<string, string>) Create and queues the device token to all services registered for this type of device token.
QueueNotification(IPushToken, string, INotification) Create and queues the device token to all services registered for this type of device token.
QueueNotification(UNotification) Queues the notification.
QueueNotification(IEnumerable<IPushToken>, UNotification) Create and queues sync notification for specified device tokens to all services registered.
QueueNotification<TPushNotification>(TPushNotification) Queues a notification to all services registered for this type of notification
QueueNotification<TPushNotification>(TPushNotification, string) Queues the notification to all services registered for this type of notification with a matching applicationId
QueueSyncNotification(IEnumerable<IPushToken>, Dictionary<string, string>) Create and queues sync notification for specified device tokens to all services registered.
QueueSyncNotification(IEnumerable<IPushToken>, string, Dictionary<string, string>) Create and queues sync notification for specified device tokens to all services registered.
QueueSyncNotification(IPushToken, string, Dictionary<string, string>) Create and queues sync notification for specified device tokens to all services registered.
RegisterService<TPushNotification>(IPushService, string, bool) Registers the service to be eligible to handle queued notifications of the specified type
RegisterService<TPushNotification>(IPushService, bool) Registers the service to be eligible to handle queued notifications of the specified type
StopAllServices(bool) Stops all services that have been registered with the broker
StopAllServices<TNotification>(bool) Stops and removes all registered services for the given notification type
StopAllServices<TNotification>(string, bool) Stops and removes all registered services for the given application identifier and notification type
StopAllServices(string, bool) Stops and removes all registered services for the given application identifier

Events

OnChannelCreated Occurs when push channel is created.
OnChannelDestroyed Occurs when push channel is destoyed.
OnChannelException Occurs when an exception thrown from push channel.
OnDeviceSubscriptionChanged Occurs when device subscription changed.
OnDeviceSubscriptionExpired Occurs when device subscription expired.
OnNotificationFailed Occurs when notification failed.
OnNotificationRequeue Occurs when notification is requeued.
OnNotificationSent Occurs when notification sent.
OnServiceException Occurs when an exception thrown from push service.

Public Constructors

public PushServiceManager()

Static Properties

public static PushServiceManager Instance { get; }

Gets the singleton instance.

Static Methods

public static OSKind GetOperatingSystem(string operatingSystem)

Gets the operating system.

Parameters

operatingSystem The operating system.

Public Methods

public IEnumerable<IPushService> GetAllRegistrations()

Gets all the registered services

Return Types

The registered services

public IEnumerable<IPushService> GetRegistrations<TNotification>()

Gets all the registered services for the given notification type

Type Parameters

TNotification Type of notification

Return Types

The registered services

public IEnumerable<IPushService> GetRegistrations(string applicationId)

Gets all the registered services for the given application identifier

Parameters

applicationId Application identifier

Return Types

The registered services

public IEnumerable<IPushService> GetRegistrations<TNotification>(string applicationId)

Gets all the registered services for the given notification type and application identifier

Type Parameters

TNotification Type of notification

Parameters

applicationId Application identifier

Return Types

The registered services

public IEnumerable<IPushService> GetRegistrations(Type type, string applicationId)

Gets all the registered services for the given notification type and application identifier

Parameters

type The type of notification
applicationId The application identifier.

Return Types

The registered services

public void QueueNotification(IEnumerable<IPushToken> tokens, string title, string message, Dictionary<string, string> data)

Create and queues all device tokens to all services registered.

Parameters

tokens List of devices tokens
title Title of the notification
message Message of the notification
data Additional data of the notification

public void QueueNotification(IEnumerable<IPushToken> tokens, string applicationId, string title, string message, Dictionary<string, string> data)

Create and queues all device tokens to all services registered.

Parameters

tokens List of devices tokens
applicationId Application identifier
title Title of the notification
message Message of the notification
data Additional data of the notification

public void QueueNotification(IPushToken token, string title, string message, Dictionary<string, string> data)

Create and queues the device token to all services registered for this type of device token.

Parameters

token Device token
title Title of the notification
message Message of the notification
data Additional data of the notification

public void QueueNotification(IPushToken token, string applicationId, string title, string message, Dictionary<string, string> data)

Create and queues the device token to all services registered for this type of device token.

Parameters

token Device token
applicationId Application identifier
title Title of the notification
message Message of the notification
data Additional data of the notification

public void QueueNotification(IPushToken token, string applicationId, INotification notification)

Create and queues the device token to all services registered for this type of device token.

Parameters

token Device token
applicationId Application identifier
notification The notification object to be sent

public void QueueNotification(UNotification notification)

Queues the notification.

Parameters

notification The notification.

public void QueueNotification(IEnumerable<IPushToken> tokens, UNotification notification)

Create and queues sync notification for specified device tokens to all services registered.

Parameters

tokens Device token
notification The notification object to be sent

public void QueueNotification<TPushNotification>(TPushNotification notification)

Queues a notification to all services registered for this type of notification

Type Parameters

TPushNotification The 1st type parameter.

Parameters

notification Notification.

public void QueueNotification<TPushNotification>(TPushNotification notification, string applicationId)

Queues the notification to all services registered for this type of notification with a matching applicationId

Type Parameters

TPushNotification Type of Notification

Parameters

notification Notification
applicationId Application identifier

public void QueueSyncNotification(IEnumerable<IPushToken> tokens, Dictionary<string, string> data)

Create and queues sync notification for specified device tokens to all services registered.

Parameters

tokens List of devices tokens
data Additional data of the notification

public void QueueSyncNotification(IEnumerable<IPushToken> tokens, string applicationId, Dictionary<string, string> data)

Create and queues sync notification for specified device tokens to all services registered.

Parameters

tokens List of devices tokens
applicationId Application identifier
data Additional data of the notification

public void QueueSyncNotification(IPushToken token, string applicationId, Dictionary<string, string> data)

Create and queues sync notification for specified device tokens to all services registered.

Parameters

token Device token
applicationId Application identifier
data Additional data of the notification

public void RegisterService<TPushNotification>(IPushService pushService, string applicationId, bool raiseErrorOnDuplicateRegistrations)

Registers the service to be eligible to handle queued notifications of the specified type

Type Parameters

TPushNotification Type of notifications to register the service for

Parameters

pushService Push service to be registered
applicationId Arbitrary Application identifier to register this service with. When queueing notifications you can specify the same Application identifier to ensure they get queued to the same service instance
raiseErrorOnDuplicateRegistrations If set to true raises an error if there is an existing registration for the given notification type.

public void RegisterService<TPushNotification>(IPushService pushService, bool raiseErrorOnDuplicateRegistrations)

Registers the service to be eligible to handle queued notifications of the specified type

Type Parameters

TPushNotification Type of notifications to register the service for

Parameters

pushService Push service to be registered
raiseErrorOnDuplicateRegistrations If set to true raises an error if there is an existing registration for the given notification type.

public void StopAllServices(bool waitForQueuesToFinish)

Stops all services that have been registered with the broker

Parameters

waitForQueuesToFinish If set to true wait for queues to finish.

public void StopAllServices<TNotification>(bool waitForQueuesToFinish)

Stops and removes all registered services for the given notification type

Type Parameters

TNotification Notification Type

Parameters

waitForQueuesToFinish If set to true waits for the queues to be drained before returning.

public void StopAllServices<TNotification>(string applicationId, bool waitForQueuesToFinish)

Stops and removes all registered services for the given application identifier and notification type

Type Parameters

TNotification The 1st type parameter.

Parameters

applicationId Application identifier.
waitForQueuesToFinish If set to true waits for queues to be drained before returning.

public void StopAllServices(string applicationId, bool waitForQueuesToFinish)

Stops and removes all registered services for the given application identifier

Parameters

applicationId Application identifier.
waitForQueuesToFinish If set to true waits for queues to be drained before returning.

Events

public event ChannelCreatedDelegate OnChannelCreated

Occurs when push channel is created.

public event ChannelDestroyedDelegate OnChannelDestroyed

Occurs when push channel is destoyed.

public event ChannelExceptionDelegate OnChannelException

Occurs when an exception thrown from push channel.

public event DeviceSubscriptionChangedDelegate OnDeviceSubscriptionChanged

Occurs when device subscription changed.

public event DeviceSubscriptionExpiredDelegate OnDeviceSubscriptionExpired

Occurs when device subscription expired.

public event NotificationFailedDelegate OnNotificationFailed

Occurs when notification failed.

public event NotificationRequeueDelegate OnNotificationRequeue

Occurs when notification is requeued.

public event NotificationSentDelegate OnNotificationSent

Occurs when notification sent.

public event ServiceExceptionDelegate OnServiceException

Occurs when an exception thrown from push service.

  • No labels