前往主控台

FirebaseMessagingService

public class FirebaseMessagingService extends EnhancedIntentService

Base class for receiving messages from Firebase Cloud Messaging.

Extending this class is required to be able to handle downstream messages. It also provides functionality to automatically display notifications, and has methods that are invoked to give the status of upstream messages.

Override base class methods to handle any events required by the application. All methods are invoked on a background thread, and may be called when the app is in the background or not open.

Include the following in the manifest:

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

Inherited Constant Summary

Public Constructor Summary

Public Method Summary

void
onDeletedMessages()
Called when the FCM server deletes pending messages.
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
onNewToken(String token)
Called when a new token for the default Firebase project is generated.
void
onSendError(String msgId, Exception exception)
Called when there was an error sending an upstream message.

Inherited Method Summary