SafetyNet provides a set of services and APIs that help protect your app against security threats, including device tampering, bad URLs, potentially harmful apps, and fake users.
Before you begin
To prepare your app, first make sure that your app's build file uses the following values:
- A
minSdkVersion
of19
or higher - A
compileSdkVersion
of28
or higher
Then complete the steps in the following sections.
Configure your app
In your settings.gradle
file, include
Google's Maven repository
and Maven central repository
in both your dependencyResolutionManagement
and pluginManagement
repository sections:
pluginManagement {
repositories {
...
google()
mavenCentral()
}
}
dependencyResolutionManagement {
...
repositories {
google()
mavenCentral()
}
}
Add the Google Play services
dependency for the Google Play API to your
module's Gradle build file,
which is commonly app/build.gradle
:
dependencies {
implementation 'com.google.android.gms:play-services-safetynet:18.1.0'
}
More information
- SafetyNet Attestation API
- Learn how the SafetyNet Attestation API provides a cryptographically-signed attestation, assessing the integrity of the Android device your app is running on.
- SafetyNet Safe Browsing API
- Learn how the SafetyNet Safe Browsing API provides services for determining whether a URL has been marked as a known threat by Google.
- SafetyNet reCAPTCHA API
- Learn how the SafetyNet reCAPTCHA API protects your app from malicious traffic.
- SafetyNet Verify Apps API
- Learn how the SafetyNet Verify Apps API protects devices against potentially harmful apps.