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.
Instance ID provides a unique identifier for each app instance and a mechanism to authenticate and authorize actions (for example, sending a GCM message).
Instance ID is stable but may become invalid, if:
- App deletes Instance ID
- Device is factory reset
- User uninstalls the app
- User clears app data
getId()
to
request a new Instance ID. To prove ownership of Instance ID and to allow servers to access
data or services associated with the app, call
getToken(String, String)
.
Constant Summary
String | ERROR_MAIN_THREAD | Blocking methods must not be called on the main thread. |
String | ERROR_MISSING_INSTANCEID_SERVICE | Tokens can't be generated. |
String | ERROR_SERVICE_NOT_AVAILABLE | The device cannot read the response, or there was a server error. |
String | ERROR_TIMEOUT | Timeout waiting for a response. |
Public Method Summary
void |
deleteInstanceID()
This method 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.
|
void |
deleteToken(String
authorizedEntity, String scope)
This method 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.
|
long |
getCreationTime()
This method 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.
|
String |
getId()
This method 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.
|
static InstanceID |
getInstance(Context
context)
This method 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.
|
String |
getToken(String
authorizedEntity, String scope)
This method 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.
|
String |
getToken(String
authorizedEntity, String scope,
Bundle
extras)
This method 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.
|
Inherited Method Summary
Constants
public static final String ERROR_MAIN_THREAD
Blocking methods must not be called on the main thread.
public static final String ERROR_MISSING_INSTANCEID_SERVICE
Tokens can't be generated. Only devices with Google Play are supported.
public static final String ERROR_SERVICE_NOT_AVAILABLE
The device cannot read the response, or there was a server error. Application should retry the request later using exponential backoff and retry (on each subsequent failure increase delay before retrying).
public static final String ERROR_TIMEOUT
Timeout waiting for a response.
Public Methods
public void deleteInstanceID ()
This method 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.
Resets Instance ID and revokes all tokens.
Throws
IOException |
---|
public void deleteToken (String authorizedEntity, String scope)
This method 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.
Revokes access to a scope (action) for an entity previously authorized by
getToken(String, String)
.
Do not call this function on the main thread.
Parameters
authorizedEntity | Entity that must no longer have access. |
---|---|
scope | Action that entity is no longer authorized to perform. |
Throws
IOException | if the request fails. |
---|
public long getCreationTime ()
This method 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.
Returns time when instance ID was created.
Returns
- Time when instance ID was created (milliseconds since Epoch).
public String getId ()
This method 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.
Returns a stable identifier that uniquely identifies the app instance.
Returns
- The identifier for the application instance.
public static InstanceID getInstance (Context context)
This method 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.
Returns an instance of this class.
Returns
- InstanceID instance.
public String getToken (String authorizedEntity, String scope)
This method 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.
Returns a token that authorizes an Entity (example: cloud service) to perform an action on behalf of the application identified by Instance ID.
This is similar to an OAuth2 token except, it applies to the application instance instead of a user.
Do not call this function on the main thread.
Parameters
authorizedEntity | Entity authorized by the token. |
---|---|
scope | Action authorized for authorizedEntity. |
Returns
- a token that can identify and authorize the instance of the application on the device.
Throws
IOException | if the request fails. |
---|
public String getToken (String authorizedEntity, String scope, Bundle extras)
This method 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.
Returns a token that authorizes an Entity (example: cloud service) to perform an action on behalf of the application identified by Instance ID.
This is similar to an OAuth2 token except, it applies to the application instance instead of a user.
Do not call this function on the main thread.
Parameters
authorizedEntity | Entity authorized by the token. |
---|---|
scope | Action authorized for authorizedEntity. |
extras | additional parameters specific to each token scope. Bundle keys starting with 'GCM.' and 'GOOGLE.' are reserved. |
Returns
- a token that can identify and authorize the instance of the application on the device.
Throws
IOException | if the request fails. |
---|