The interface for clients to access Block Store.
- Clients should call
storeBytes(StoreBytesData)
to store authentication credentialsbyte[] bytes
to enable seamless sign-in on other devices. - Clients should call
retrieveBytes()
to fetch the authentication credentials to seamlessly sign in users on a newly setup device.
Constant Summary
int | MAX_SIZE | Maximum allowed size of byte blobs that can be
stored using BlockstoreClient#storeBytes . |
Public Method Summary
abstract Task<Boolean> |
isEndToEndEncryptionAvailable()
Returns a
Task
which asynchronously determines whether Block Store data backed up to the cloud
will be end-to-end encrypted.
|
abstract Task<byte[]> |
retrieveBytes()
Returns a
Task
which asynchronously retrieves the previously-stored bytes, if any.
|
abstract Task<Integer> |
storeBytes(StoreBytesData
storeBytesData)
Returns a
Task
which asynchronously stores the provided byte[] bytes .
|
Constants
public static final int MAX_SIZE
Maximum allowed size of byte blobs that can be stored using
BlockstoreClient#storeBytes
.
Public Methods
public abstract Task<Boolean> isEndToEndEncryptionAvailable ()
Returns a Task
which
asynchronously determines whether Block Store data backed up to the cloud will be
end-to-end encrypted.
End-to-end encryption is available for Pie and above devices with a lockscreen PIN/pattern.
The Boolean
return value is whether Block Store data backed up to the
cloud will be end-to-end encrypted.
public abstract Task<byte[]> retrieveBytes ()
Returns a Task
which
asynchronously retrieves the previously-stored bytes, if any. The maximum size of the
byte[]
is the
MAX_SIZE
.
The byte[]
may have been written on the same device or may have been
transferred during the device setup.
Use this API to seamlessly sign-in users to the apps on a new device.
If no data is found, returns an empty byte array. Note that the data may be cleared by Google Play services on certain user actions, like user clearing app storage (among others).
public abstract Task<Integer> storeBytes (StoreBytesData storeBytesData)
Returns a Task
which
asynchronously stores the provided byte[] bytes
.
The data is stored locally. It is transferred to a new device during the device-to-device restore if a google account is also transferred.
If in
StoreBytesData.shouldBackupToCloud()
is set to true
, the data
will also be backed up to the cloud in the next periodic sync. Cloud backup data is
transferred to a new device during the cloud restore using Google's Backup & Restore
services.
The maximum size of the byte[] bytes
allowed is
MAX_SIZE
; otherwise, the API will throw an Exception
.
The Integer
return value is the size of byte[] bytes
successfully stored.
Use this API to store small data blobs that can enable seamless sign in for your apps. The API may be called periodically (for example, a few times per day) to refresh the data blob. Successive calls to this API will overwrite the existing bytes.