This page explains how to add SafetyNet APIs to your app.
Before you begin
To prepare your app, first make sure that your app's build file uses the following values:
- A
minSdkVersionof19or higher - A
compileSdkVersionof28or 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 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.