Google is committed to advancing racial equity for Black communities. See how.

SafetyNet

public final class SafetyNet extends Object

The SafetyNet API provides access to Google services that help you assess the health and safety of an Android device.

To use SafetyNet, call getClient(Context) or getClient(Activity).

Field Summary

public static final Api<Api.ApiOptions.NoOptions> API This field was deprecated. use getClient(Context) or getClient(Activity).
public static final SafetyNetApi SafetyNetApi This field was deprecated. use getClient(Context) or getClient(Activity).

Public Method Summary

static SafetyNetClient
getClient(Activity activity)
Returns a SafetyNetClient that is used to access all APIs that are called when the app has a foreground Activity.
static SafetyNetClient
getClient(Context context)
Returns a SafetyNetClient that is used to access all APIs that are called without access to a foreground Activity.

Inherited Method Summary

Fields

public static final Api<Api.ApiOptions.NoOptions> API

This field was deprecated.
use getClient(Context) or getClient(Activity).

The API necessary to use SafetyNet.

public static final SafetyNetApi SafetyNetApi

This field was deprecated.
use getClient(Context) or getClient(Activity).

The entry point for interacting with the SafetyNet APIs which help assess the health and safety of an Android device.

Public Methods

public static SafetyNetClient getClient (Activity activity)

Returns a SafetyNetClient that is used to access all APIs that are called when the app has a foreground Activity.

Use this method over getClient(Context) if your app has a foreground Activity and you will be making multiple API calls to improve performance.

public static SafetyNetClient getClient (Context context)

Returns a SafetyNetClient that is used to access all APIs that are called without access to a foreground Activity.