Cómo proteger tu app contra amenazas de seguridad con SafetyNet
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
SafetyNet proporciona un conjunto de servicios y APIs que ayudan a proteger tu app contra amenazas de seguridad, lo que incluye la manipulación de dispositivos, URLs incorrectas, apps potencialmente dañinas y usuarios falsos.
Antes de comenzar
Para preparar tu app, primero asegúrate de que su archivo de compilación use los siguientes valores:
Una minSdkVersion de 19 o más
Una compileSdkVersion de 28 o más
Luego, sigue los pasos en las siguientes secciones.
Descubre cómo la API de SafetyNet Attestation proporciona una certificación con firma criptográfica que evalúa la integridad del dispositivo Android en el que se ejecuta tu app.
El contenido y las muestras de código que aparecen en esta página están sujetas a las licencias que se describen en la Licencia de Contenido. Java y OpenJDK son marcas registradas de Oracle o sus afiliados.
Última actualización: 2023-12-14 (UTC)
[null,null,["Última actualización: 2023-12-14 (UTC)"],[],[],null,["# How to add the SafetyNet API dependency\n\n| **Warning:** The SafetyNet Attestation API is deprecated and has been replaced by the [Play Integrity API](/google/play/integrity/overview). The SafetyNet reCAPTCHA API is being deprecated and replaced with [reCAPTCHA](https://cloud.google.com/recaptcha/docs/instrument-android-apps).\n\nThis page explains how to add SafetyNet APIs to your app.\n\nBefore you begin\n----------------\n\nTo prepare your app, first make sure that your app's build file uses the\nfollowing values:\n\n- A `minSdkVersion` of `19` or higher\n- A `compileSdkVersion` of `28` or higher\n\nThen complete the steps in the following sections.\n\nConfigure your app\n------------------\n\nIn your `settings.gradle` file, include\n[Google's Maven repository](https://maven.google.com/web/index.html)\nand [Maven central repository](https://search.maven.org/artifact)\nin both your `dependencyResolutionManagement` and `pluginManagement` repository sections: \n\n pluginManagement {\n repositories {\n ...\n google()\n mavenCentral()\n }\n }\n\n dependencyResolutionManagement {\n ...\n repositories {\n google()\n mavenCentral()\n }\n }\n\nAdd the [Google Play services](http://developer.google.com/android)\ndependency for the Google Play API to your\n[module's Gradle build file](/studio/build#module-level),\nwhich is commonly `app/build.gradle`: \n\n dependencies {\n implementation 'com.google.android.gms:play-services-safetynet:18.1.0'\n }\n\nMore information\n----------------\n\n**[SafetyNet Safe Browsing API](/training/safetynet/safebrowsing)**\n: Learn how the SafetyNet Safe Browsing API provides services for determining\n whether a URL has been marked as a known threat by Google.\n\n**[SafetyNet reCAPTCHA API](/training/safetynet/recaptcha)**\n: Learn how the SafetyNet reCAPTCHA API protects your app from malicious\n traffic.\n\n**[SafetyNet Verify Apps API](/training/safetynet/verify-apps)**\n: Learn how the SafetyNet Verify Apps API protects devices against potentially\n harmful apps.\n\nAdditional resources\n--------------------\n\n- [Security tips](/training/articles/security-tips)\n- [Compatibility Test Suite (CTS)](https://source.android.com/compatibility/cts)"]]