Stay organized with collections Save and categorize content based on your preferences.
public class InstanceIDListenerService extends Service

This class was deprecated.
Instance ID is deprecated and replaced by Firebase Instance ID. See the FCM migration guide for details on how to migrate to Firebase Instance ID.

Base class to handle Instance ID service notifications on token refresh.

Any app using Instance ID or GCM must include a class extending InstanceIDListenerService and implement onTokenRefresh().

Include the following in the manifest:

 <service android:name=".YourInstanceIDListenerService" android:exported="false">
         <action android:name=""/>

Do not export this service. Instead, keep it private to prevent other apps accessing your service.

Inherited Constant Summary

Public Constructor Summary

Public Method Summary

Called when the system determines that the tokens need to be refreshed.

Inherited Method Summary

Public Constructors

public InstanceIDListenerService ()

Public Methods

public void onTokenRefresh ()

Called when the system determines that the tokens need to be refreshed. The application should call getToken() and send the tokens to all application servers.

This will not be called very frequently, it is needed for key rotation and to handle special cases.

The system will throttle the refresh event across all devices to avoid overloading application servers with token updates.