TokenStore

interface TokenStore
androidx.browser.trusted.TokenStore

Users should implement this interface to persist the given Token (across app restarts). Once implemented, they should override TrustedWebActivityService#getTokenStore() to return an instance. Finally, they should execute the following code themselves to set the verified provider:

<code>TokenStore tokenStore  = ... // Instantiate the implemented class.
  String packageName = ... // Package name of the Trusted Web Activity provider.
 
  tokenStore.store(Token.create(packageName, getPackageManager());
  </code>
There is only a single Token stored at a time. Note that load will be called by TrustedWebActivityService on a binder thread. Whereas store can be called by the user on whichever thread they like.

Summary

Public methods

abstract Token?

This method returns the Token previously persisted by a call to store.

abstract Unit
store(@Nullable token: Token?)

This method should persist the given Token.

Public methods

load

@BinderThread @Nullable abstract fun load(): Token?

This method returns the Token previously persisted by a call to store.

Return
Token?: The previously persisted Token, or null if none exist. This method will be called on a binder thread by TrustedWebActivityService.

store

@WorkerThread abstract fun store(@Nullable token: Token?): Unit

This method should persist the given Token. Subsequent calls will overwrite the previously given Token.

Parameters
token Token?: The token to persist. It may be null to clear the storage.