public interface

# SafetyNetApi

com.google.android.gms.safetynet.SafetyNetApi

## Class Overview

The main entry point for interacting with SafetyNet.

## Summary

Nested Classes
interface | SafetyNetApi.AttestationResult | Result that contains a Compatibility Test Suite attestation result.
interface | SafetyNetApi.SafeBrowsingResult | Result from `lookupUri(GoogleApiClient, String, int...)`.

Public Methods
abstract PendingResult<SafetyNetApi.AttestationResult> | attest(GoogleApiClient client, byte[] nonce) Provides attestation results for the device.
abstract PendingResult<SafetyNetApi.SafeBrowsingResult> | lookupUri(GoogleApiClient client, String uri, int... threatTypes) Checks whether a URI is known to have specific threats.

## Public Methods

#### public abstract PendingResult<SafetyNetApi.AttestationResult> attest (GoogleApiClient client, byte[] nonce)

Provides attestation results for the device.

An attestation result states whether the device where it is running matches the profile of a device that has passed Android compatibility testing.

When you request a compatibility check, you must provide a nonce, which is a random token generated in a cryptographically secure manner. You can obtain a nonce by generating one within your app each time you make a compatibility check request. As a more secure option, you can obtain a nonce from your own server, using a secure connection.

A nonce used with an attesation request should be at least 16 bytes in length. After you make a request, the response from the `SafetyNetApi.AttestationResult` includes your nonce, so you can verify it against the one you sent. You should only use a nonce value once, for a single request. Use a different nonce for any subsequent attestation requests. For tips on using cryptography functions, see Security Tips.

##### Parameters

client | The `GoogleApiClient` to service the call. The client must be connected using `connect()` before invoking this method.
nonce | A cryptographic nonce used for anti-replay and tracking of requests.

##### See Also

- Compatibility Test Suite

#### public abstract PendingResult<SafetyNetApi.SafeBrowsingResult> lookupUri (GoogleApiClient client, String uri, int... threatTypes)

Checks whether a URI is known to have specific threats.

##### Parameters

client | The `GoogleApiClient` to service the call. The client must be connected using `connect()` before invoking this method.
uri | A `String` that represents the URI that should be looked up.
threatTypes | integers from `SafeBrowsingThreat` to indicate that the URI should be queried for these threat types.