FirebaseAdmin. Messaging. FirebaseMessaging
This is the entry point to all server-side Firebase Cloud Messaging (FCM) operations.
Summary
You can get an instance of this class via FirebaseMessaging.DefaultInstance
.
Inheritance
Inherits from: FirebaseAdmin.IFirebaseService
Properties |
|
---|---|
DefaultInstance
|
static FirebaseMessaging
Gets the messaging instance associated with the default Firebase app.
|
Public static functions |
|
---|---|
GetMessaging(FirebaseApp app)
|
Returns the messaging instance for the specified app.
|
Public functions |
|
---|---|
SendAllAsync(IEnumerable< Message > messages)
|
async Task< BatchResponse >
Sends all the messages in the given list via Firebase Cloud Messaging.
|
SendAllAsync(IEnumerable< Message > messages, CancellationToken cancellationToken)
|
async Task< BatchResponse >
Sends all the messages in the given list via Firebase Cloud Messaging.
|
SendAllAsync(IEnumerable< Message > messages, bool dryRun)
|
async Task< BatchResponse >
Sends all the messages in the given list via Firebase Cloud Messaging.
|
SendAllAsync(IEnumerable< Message > messages, bool dryRun, CancellationToken cancellationToken)
|
async Task< BatchResponse >
Sends all the messages in the given list via Firebase Cloud Messaging.
|
SendAsync(Message message)
|
async Task< string >
Sends a message to the FCM service for delivery.
|
SendAsync(Message message, CancellationToken cancellationToken)
|
async Task< string >
Sends a message to the FCM service for delivery.
|
SendAsync(Message message, bool dryRun)
|
async Task< string >
Sends a message to the FCM service for delivery.
|
SendAsync(Message message, bool dryRun, CancellationToken cancellationToken)
|
async Task< string >
Sends a message to the FCM service for delivery.
|
SendEachAsync(IEnumerable< Message > messages)
|
async Task< BatchResponse >
Sends each message in the given list via Firebase Cloud Messaging.
|
SendEachAsync(IEnumerable< Message > messages, CancellationToken cancellationToken)
|
async Task< BatchResponse >
Sends each message in the given list via Firebase Cloud Messaging.
|
SendEachAsync(IEnumerable< Message > messages, bool dryRun)
|
async Task< BatchResponse >
Sends each message in the given list via Firebase Cloud Messaging.
|
SendEachAsync(IEnumerable< Message > messages, bool dryRun, CancellationToken cancellationToken)
|
async Task< BatchResponse >
Sends each message in the given list via Firebase Cloud Messaging.
|
SendEachForMulticastAsync(MulticastMessage message)
|
async Task< BatchResponse >
Sends the given multicast message to all the FCM registration tokens specified in it.
|
SendEachForMulticastAsync(MulticastMessage message, CancellationToken cancellationToken)
|
async Task< BatchResponse >
Sends the given multicast message to all the FCM registration tokens specified in it.
|
SendEachForMulticastAsync(MulticastMessage message, bool dryRun)
|
async Task< BatchResponse >
Sends the given multicast message to all the FCM registration tokens specified in it.
|
SendEachForMulticastAsync(MulticastMessage message, bool dryRun, CancellationToken cancellationToken)
|
async Task< BatchResponse >
Sends the given multicast message to all the FCM registration tokens specified in it.
|
SendMulticastAsync(MulticastMessage message)
|
async Task< BatchResponse >
Sends the given multicast message to all the FCM registration tokens specified in it.
|
SendMulticastAsync(MulticastMessage message, CancellationToken cancellationToken)
|
async Task< BatchResponse >
Sends the given multicast message to all the FCM registration tokens specified in it.
|
SendMulticastAsync(MulticastMessage message, bool dryRun)
|
async Task< BatchResponse >
Sends the given multicast message to all the FCM registration tokens specified in it.
|
SendMulticastAsync(MulticastMessage message, bool dryRun, CancellationToken cancellationToken)
|
async Task< BatchResponse >
Sends the given multicast message to all the FCM registration tokens specified in it.
|
SubscribeToTopicAsync(IReadOnlyList< string > registrationTokens, string topic)
|
async Task< TopicManagementResponse >
Subscribes a list of registration tokens to a topic.
|
UnsubscribeFromTopicAsync(IReadOnlyList< string > registrationTokens, string topic)
|
async Task< TopicManagementResponse >
Unsubscribes a list of registration tokens from a topic.
|
Properties
DefaultInstance
static FirebaseMessaging DefaultInstance
Gets the messaging instance associated with the default Firebase app.
This property is null
if the default app doesn't yet exist.
Public static functions
GetMessaging
FirebaseMessaging GetMessaging( FirebaseApp app )
Returns the messaging instance for the specified app.
Details | |||
---|---|---|---|
Exceptions |
|
||
Parameters |
|
||
Returns |
The FirebaseMessaging instance associated with the specified app.
|
Public functions
SendAllAsync
async Task< BatchResponse > SendAllAsync( IEnumerable< Message > messages )
Sends all the messages in the given list via Firebase Cloud Messaging.
Employs batching to send the entire list as a single RPC call. Compared to the SendAsync(Message) method, this is a significantly more efficient way to send multiple messages.
Details | |||
---|---|---|---|
Exceptions |
|
||
Parameters |
|
||
Returns |
A BatchResponse containing details of the batch operation's outcome.
|
SendAllAsync
async Task< BatchResponse > SendAllAsync( IEnumerable< Message > messages, CancellationToken cancellationToken )
Sends all the messages in the given list via Firebase Cloud Messaging.
Employs batching to send the entire list as a single RPC call. Compared to the SendAsync(Message) method, this is a significantly more efficient way to send multiple messages.
Details | |||||
---|---|---|---|---|---|
Exceptions |
|
||||
Parameters |
|
||||
Returns |
A BatchResponse containing details of the batch operation's outcome.
|
SendAllAsync
async Task< BatchResponse > SendAllAsync( IEnumerable< Message > messages, bool dryRun )
Sends all the messages in the given list via Firebase Cloud Messaging.
Employs batching to send the entire list as a single RPC call. Compared to the SendAsync(Message) method, this is a significantly more efficient way to send multiple messages.
Details | |||||
---|---|---|---|---|---|
Exceptions |
|
||||
Parameters |
|
||||
Returns |
A BatchResponse containing details of the batch operation's outcome.
|
SendAllAsync
async Task< BatchResponse > SendAllAsync( IEnumerable< Message > messages, bool dryRun, CancellationToken cancellationToken )
Sends all the messages in the given list via Firebase Cloud Messaging.
Employs batching to send the entire list as a single RPC call. Compared to the SendAsync(Message) method, this is a significantly more efficient way to send multiple messages.
Details | |||||||
---|---|---|---|---|---|---|---|
Exceptions |
|
||||||
Parameters |
|
||||||
Returns |
A BatchResponse containing details of the batch operation's outcome.
|
SendAsync
async Task< string > SendAsync( Message message )
Sends a message to the FCM service for delivery.
The message gets validated both by the Admin SDK, and the remote FCM service. A successful return value indicates that the message has been successfully sent to FCM, where it has been accepted by the FCM service.
Details | |||||||
---|---|---|---|---|---|---|---|
Exceptions |
|
||||||
Parameters |
|
||||||
Returns |
A task that completes with a message ID string, which represents successful handoff to FCM.
|
SendAsync
async Task< string > SendAsync( Message message, CancellationToken cancellationToken )
Sends a message to the FCM service for delivery.
The message gets validated both by the Admin SDK, and the remote FCM service. A successful return value indicates that the message has been successfully sent to FCM, where it has been accepted by the FCM service.
Details | |||||||
---|---|---|---|---|---|---|---|
Exceptions |
|
||||||
Parameters |
|
||||||
Returns |
A task that completes with a message ID string, which represents successful handoff to FCM.
|
SendAsync
async Task< string > SendAsync( Message message, bool dryRun )
Sends a message to the FCM service for delivery.
The message gets validated both by the Admin SDK, and the remote FCM service. A successful return value indicates that the message has been successfully sent to FCM, where it has been accepted by the FCM service.
If the dryRun option is set to true, the message will not be actually sent to the recipients. Instead, the FCM service performs all the necessary validations, and emulates the send operation. This is a good way to check if a certain message will be accepted by FCM for delivery.
Details | |||||||
---|---|---|---|---|---|---|---|
Exceptions |
|
||||||
Parameters |
|
||||||
Returns |
A task that completes with a message ID string, which represents successful handoff to FCM.
|
SendAsync
async Task< string > SendAsync( Message message, bool dryRun, CancellationToken cancellationToken )
Sends a message to the FCM service for delivery.
The message gets validated both by the Admin SDK, and the remote FCM service. A successful return value indicates that the message has been successfully sent to FCM, where it has been accepted by the FCM service.
If the dryRun option is set to true, the message will not be actually sent to the recipients. Instead, the FCM service performs all the necessary validations, and emulates the send operation. This is a good way to check if a certain message will be accepted by FCM for delivery.
Details | |||||||
---|---|---|---|---|---|---|---|
Exceptions |
|
||||||
Parameters |
|
||||||
Returns |
A task that completes with a message ID string, which represents successful handoff to FCM.
|
SendEachAsync
async Task< BatchResponse > SendEachAsync( IEnumerable< Message > messages )
Sends each message in the given list via Firebase Cloud Messaging.
Unlike SendAllAsync(IEnumerable{Message}), this method makes an HTTP call for each message in the given list.
Details | |||
---|---|---|---|
Exceptions |
|
||
Parameters |
|
||
Returns |
A BatchResponse containing details of the batch operation's outcome.
|
SendEachAsync
async Task< BatchResponse > SendEachAsync( IEnumerable< Message > messages, CancellationToken cancellationToken )
Sends each message in the given list via Firebase Cloud Messaging.
Unlike SendAllAsync(IEnumerable{Message}, CancellationToken), this method makes an HTTP call for each message in the given list.
Details | |||||
---|---|---|---|---|---|
Exceptions |
|
||||
Parameters |
|
||||
Returns |
A BatchResponse containing details of the batch operation's outcome.
|
SendEachAsync
async Task< BatchResponse > SendEachAsync( IEnumerable< Message > messages, bool dryRun )
Sends each message in the given list via Firebase Cloud Messaging.
Unlike SendAllAsync(IEnumerable{Message}, bool), this method makes an HTTP call for each message in the given list.
Details | |||||
---|---|---|---|---|---|
Exceptions |
|
||||
Parameters |
|
||||
Returns |
A BatchResponse containing details of the batch operation's outcome.
|
SendEachAsync
async Task< BatchResponse > SendEachAsync( IEnumerable< Message > messages, bool dryRun, CancellationToken cancellationToken )
Sends each message in the given list via Firebase Cloud Messaging.
Unlike SendAllAsync(IEnumerable{Message}, bool, CancellationToken), this method makes an HTTP call for each message in the given list.
Details | |||||||
---|---|---|---|---|---|---|---|
Exceptions |
|
||||||
Parameters |
|
||||||
Returns |
A BatchResponse containing details of the batch operation's outcome.
|
SendEachForMulticastAsync
async Task< BatchResponse > SendEachForMulticastAsync( MulticastMessage message )
Sends the given multicast message to all the FCM registration tokens specified in it.
Unlike SendMulticastAsync(MulticastMessage), this method makes an HTTP call for each token in the given multicast message.
Details | |||
---|---|---|---|
Exceptions |
|
||
Parameters |
|
||
Returns |
A BatchResponse containing details of the batch operation's outcome.
|
SendEachForMulticastAsync
async Task< BatchResponse > SendEachForMulticastAsync( MulticastMessage message, CancellationToken cancellationToken )
Sends the given multicast message to all the FCM registration tokens specified in it.
Unlike SendMulticastAsync(MulticastMessage, CancellationToken), this method makes an HTTP call for each token in the given multicast message.
Details | |||||
---|---|---|---|---|---|
Exceptions |
|
||||
Parameters |
|
||||
Returns |
A BatchResponse containing details of the batch operation's outcome.
|
SendEachForMulticastAsync
async Task< BatchResponse > SendEachForMulticastAsync( MulticastMessage message, bool dryRun )
Sends the given multicast message to all the FCM registration tokens specified in it.
Unlike SendMulticastAsync(MulticastMessage, bool), this method makes an HTTP call for each token in the given multicast message.
If the dryRun option is set to true, the message will not be actually sent to the recipients. Instead, the FCM service performs all the necessary validations, and emulates the send operation. This is a good way to check if a certain message will be accepted by FCM for delivery.
Details | |||||
---|---|---|---|---|---|
Exceptions |
|
||||
Parameters |
|
||||
Returns |
A BatchResponse containing details of the batch operation's outcome.
|
SendEachForMulticastAsync
async Task< BatchResponse > SendEachForMulticastAsync( MulticastMessage message, bool dryRun, CancellationToken cancellationToken )
Sends the given multicast message to all the FCM registration tokens specified in it.
Unlike SendMulticastAsync(MulticastMessage, bool, CancellationToken), this method makes an HTTP call for each token in the given multicast message.
If the dryRun option is set to true, the message will not be actually sent to the recipients. Instead, the FCM service performs all the necessary validations, and emulates the send operation. This is a good way to check if a certain message will be accepted by FCM for delivery.
Details | |||||||
---|---|---|---|---|---|---|---|
Exceptions |
|
||||||
Parameters |
|
||||||
Returns |
A BatchResponse containing details of the batch operation's outcome.
|
SendMulticastAsync
async Task< BatchResponse > SendMulticastAsync( MulticastMessage message )
Sends the given multicast message to all the FCM registration tokens specified in it.
Details | |||
---|---|---|---|
Exceptions |
|
||
Parameters |
|
||
Returns |
A BatchResponse containing details of the batch operation's outcome.
|
SendMulticastAsync
async Task< BatchResponse > SendMulticastAsync( MulticastMessage message, CancellationToken cancellationToken )
Sends the given multicast message to all the FCM registration tokens specified in it.
Details | |||||
---|---|---|---|---|---|
Exceptions |
|
||||
Parameters |
|
||||
Returns |
A BatchResponse containing details of the batch operation's outcome.
|
SendMulticastAsync
async Task< BatchResponse > SendMulticastAsync( MulticastMessage message, bool dryRun )
Sends the given multicast message to all the FCM registration tokens specified in it.
If the dryRun option is set to true, the message will not be actually sent to the recipients. Instead, the FCM service performs all the necessary validations, and emulates the send operation. This is a good way to check if a certain message will be accepted by FCM for delivery.
Details | |||||
---|---|---|---|---|---|
Exceptions |
|
||||
Parameters |
|
||||
Returns |
A BatchResponse containing details of the batch operation's outcome.
|
SendMulticastAsync
async Task< BatchResponse > SendMulticastAsync( MulticastMessage message, bool dryRun, CancellationToken cancellationToken )
Sends the given multicast message to all the FCM registration tokens specified in it.
If the dryRun option is set to true, the message will not be actually sent to the recipients. Instead, the FCM service performs all the necessary validations, and emulates the send operation. This is a good way to check if a certain message will be accepted by FCM for delivery.
Details | |||||||
---|---|---|---|---|---|---|---|
Exceptions |
|
||||||
Parameters |
|
||||||
Returns |
A BatchResponse containing details of the batch operation's outcome.
|
SubscribeToTopicAsync
async Task< TopicManagementResponse > SubscribeToTopicAsync( IReadOnlyList< string > registrationTokens, string topic )
Subscribes a list of registration tokens to a topic.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
A task that completes with a TopicManagementResponse, giving details about the topic subscription operations.
|
UnsubscribeFromTopicAsync
async Task< TopicManagementResponse > UnsubscribeFromTopicAsync( IReadOnlyList< string > registrationTokens, string topic )
Unsubscribes a list of registration tokens from a topic.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
A task that completes with a TopicManagementResponse, giving details about the topic unsubscription operations.
|