Stay organized with collections
Save and categorize content based on your preferences.
firebase::messaging::Listener
This is an abstract class.
#include <messaging.h>
Base class used to receive messages from Firebase Cloud Messaging.
Summary
You need to override base class methods to handle any events required by the application. Methods are invoked asynchronously and may be invoked on other threads.
Inheritance
Direct Known Subclasses:
firebase::messaging::PollableListener
Public functions
|
OnMessage(const Message & message)=0
|
virtual void
Called on the client when a message arrives.
|
OnTokenReceived(const char *token)=0
|
virtual void
Called on the client when a registration token arrives.
|
Public functions
OnMessage
virtual void OnMessage(
const Message & message
)=0
Called on the client when a message arrives.
Details |
Parameters |
message
|
The data describing this message.
|
|
OnTokenReceived
virtual void OnTokenReceived(
const char *token
)=0
Called on the client when a registration token arrives.
This function will eventually be called in response to a call to firebase::messaging::Initialize(...).
Details |
Parameters |
token
|
The registration token.
|
|
~Listener
virtual ~Listener()
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-01-23 UTC.
[null,null,["Last updated 2024-01-23 UTC."],[],[],null,["# firebase::messaging::Listener Class Reference\n\nfirebase::messaging::Listener\n=============================\n\n\n**This is an abstract class.**\n\n\n`#include \u003cmessaging.h\u003e`\n\nBase class used to receive messages from Firebase Cloud Messaging.\n\nSummary\n-------\n\nYou need to override base class methods to handle any events required by the application. Methods are invoked asynchronously and may be invoked on other threads.\n\n### Inheritance\n\nDirect Known Subclasses:[firebase::messaging::PollableListener](/docs/reference/cpp/class/firebase/messaging/pollable-listener)\n\n| ### Constructors and Destructors ||\n|---|---|\n| [~Listener](#classfirebase_1_1messaging_1_1_listener_1a7e1b2e00cec0379538ad9c63a568e8fa)`()` ||\n\n| ### Public functions ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------|\n| [OnMessage](#classfirebase_1_1messaging_1_1_listener_1a074808bae034dd30ba1e7756ca196281)`(const `[Message](/docs/reference/cpp/struct/firebase/messaging/message#structfirebase_1_1messaging_1_1_message)` & message)=0` | `virtual void` Called on the client when a message arrives. |\n| [OnTokenReceived](#classfirebase_1_1messaging_1_1_listener_1a837d52cfb06e12c85d4df06583567eed)`(const char *token)=0` | `virtual void` Called on the client when a registration token arrives. |\n\nPublic functions\n----------------\n\n### OnMessage\n\n```c++\nvirtual void OnMessage(\n const Message & message\n)=0\n``` \nCalled on the client when a message arrives.\n\n\u003cbr /\u003e\n\n| Details ||\n|------------|-----------------------------------------------------------------------------------------------------|\n| Parameters | |-----------|-----------------------------------| | `message` | The data describing this message. | |\n\n### OnTokenReceived\n\n```c++\nvirtual void OnTokenReceived(\n const char *token\n)=0\n``` \nCalled on the client when a registration token arrives.\n\nThis function will eventually be called in response to a call to [firebase::messaging::Initialize](/docs/reference/cpp/namespace/firebase/messaging#namespacefirebase_1_1messaging_1a5e3bd7545d50f7877ce9f72909718750)(...).\n\n\u003cbr /\u003e\n\n| Details ||\n|------------|-----------------------------------------------------------------------------|\n| Parameters | |---------|-------------------------| | `token` | The registration token. | |\n\n### \\~Listener\n\n```c++\nvirtual ~Listener()\n```"]]