public class

FirebaseMessagingService

extends Service
java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.app.Service
         ↳ com.google.firebase.messaging.FirebaseMessagingService

Class Overview

Base class for communicating with Firebase Messaging.

It also provides functionality such as automatically displaying notifications.

Override base class methods to handle any events required by the application. Methods are invoked on a background thread.

Include the following in the manifest:

 <service android:name=".YourFirebaseMessagingService">
     <intent-filter>
         <action android:name="com.google.firebase.MESSAGING_EVENT" />
     </intent-filter>
 </service>

Summary

[Expand]
Inherited Constants
From class android.app.Service
From class android.content.Context
From interface android.content.ComponentCallbacks2
Public Constructors
FirebaseMessagingService()
Public Methods
abstract void handleIntent(Intent intent)
final IBinder onBind(Intent intent)
void onDeletedMessages()
Called when GCM server deletes pending messages due to exceeded storage limits, for example, when the device cannot be reached for an extended period of time.
void onMessageReceived(RemoteMessage message)
Called when a message is received.
void onMessageSent(String msgId)
Called when an upstream message has been successfully sent to the GCM connection server.
void onSendError(String msgId, Exception exception)
Called when there was an error sending an upstream message.
final int onStartCommand(Intent originalIntent, int flags, int startId)
[Expand]
Inherited Methods
From class android.app.Service
From class android.content.ContextWrapper
From class android.content.Context
From class java.lang.Object
From interface android.content.ComponentCallbacks2
From interface android.content.ComponentCallbacks

Public Constructors

public FirebaseMessagingService ()

Public Methods

public abstract void handleIntent (Intent intent)

public final IBinder onBind (Intent intent)

public void onDeletedMessages ()

Called when GCM server deletes pending messages due to exceeded storage limits, for example, when the device cannot be reached for an extended period of time.

It is recommended to retrieve any missing messages directly from the app server.

public void onMessageReceived (RemoteMessage message)

Called when a message is received. This is also called when a notification message is received while the app is in the foreground. The notification parameters can be retrieved with getNotification().

Parameters
message Remote message that has been received.

public void onMessageSent (String msgId)

Called when an upstream message has been successfully sent to the GCM connection server.

Parameters
msgId of the upstream message sent using send(RemoteMessage).

public void onSendError (String msgId, Exception exception)

Called when there was an error sending an upstream message.

Parameters
msgId of the upstream message sent using send(RemoteMessage).
exception description of the error, typically a SendException.

public final int onStartCommand (Intent originalIntent, int flags, int startId)