Protect against security threats with SafetyNet (original) (raw)
Protect against security threats with SafetyNet
Stay organized with collections Save and categorize content based on your preferences.
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, includeGoogle's Maven repositoryand Maven central repositoryin both your dependencyResolutionManagement
and pluginManagement
repository sections:
pluginManagement {
repositories {
...
google()
mavenCentral()
}
}
dependencyResolutionManagement {
...
repositories {
google()
mavenCentral()
}
}
Add the Google Play servicesdependency for the Google Play API to yourmodule's Gradle build file, which is commonly app/build.gradle
:
dependencies {
implementation 'com.google.android.gms:play-services-safetynet:18.1.0'
}
More information
Learn how the SafetyNet Attestation API provides a cryptographically-signed attestation, assessing the integrity of the Android device your app is running on.
Learn how the SafetyNet Safe Browsing API provides services for determining whether a URL has been marked as a known threat by Google.
Learn how the SafetyNet reCAPTCHA API protects your app from malicious traffic.
Learn how the SafetyNet Verify Apps API protects devices against potentially harmful apps.
Additional resources
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-28 UTC.