chrome.instanceID
| Description: |
Use chrome.instanceID to access the Instance ID service.
|
| Availability: |
Since Chrome 46.
|
| Permissions: |
"gcm"
|
Summary
| Methods | |
|---|---|
getID −
chrome.instanceID.getID(function callback)
| |
getCreationTime −
chrome.instanceID.getCreationTime(function callback)
| |
getToken −
chrome.instanceID.getToken(object getTokenParams, function callback)
| |
deleteToken −
chrome.instanceID.deleteToken(object deleteTokenParams, function callback)
| |
deleteID −
chrome.instanceID.deleteID(function callback)
| |
| Events | |
| onTokenRefresh | |
Methods
getID
chrome.instanceID.getID(function callback)
Retrieves an identifier for the app instance. The instance ID will be returned by the callback. The same ID will be returned as long as the application identity has not been revoked or expired.
| Parameters | |||||
|---|---|---|---|---|---|
| function | callback |
Function called when the retrieval completes. It should check runtime.lastError for error when instanceID is empty. The callback parameter should be a function that looks like this: function(string instanceID) {...};
|
|||
getCreationTime
chrome.instanceID.getCreationTime(function callback)
Retrieves the time when the InstanceID has been generated. The creation time will be returned by the callback.
| Parameters | |||||
|---|---|---|---|---|---|
| function | callback |
Function called when the retrieval completes. It should check runtime.lastError for error when creationTime is zero. The callback parameter should be a function that looks like this: function(double creationTime) {...};
|
|||
getToken
chrome.instanceID.getToken(object getTokenParams, function callback)
Return a token that allows the authorized entity to access the service defined by scope.
| Parameters | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| object | getTokenParams |
Parameters for getToken.
|
|||||||||
| function | callback |
Function called when the retrieval completes. It should check runtime.lastError for error when token is empty. The callback parameter should be a function that looks like this: function(string token) {...};
|
|||||||||
deleteToken
chrome.instanceID.deleteToken(object deleteTokenParams, function callback)
Revokes a granted token.
| Parameters | ||||||||
|---|---|---|---|---|---|---|---|---|
| object | deleteTokenParams |
Parameters for deleteToken.
|
||||||
| function | callback |
Function called when the token deletion completes. The token was revoked successfully if runtime.lastError is not set. The callback parameter should be a function that looks like this: function() {...};
|
||||||
deleteID
chrome.instanceID.deleteID(function callback)
Resets the app instance identifier and revokes all tokens associated with it.
| Parameters | ||
|---|---|---|
| function | callback |
Function called when the deletion completes. The instance identifier was revoked successfully if runtime.lastError is not set. The callback parameter should be a function that looks like this: function() {...};
|
Events
onTokenRefresh
Fired when all the granted tokens need to be refreshed.
addListener
chrome.instanceID.onTokenRefresh.addListener(function callback)
| Parameters | ||
|---|---|---|
| function | callback |
The callback parameter should be a function that looks like this: function() {...};
|