קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
בדף הזה נסביר איך להוסיף ממשקי API של SafetyNet לאפליקציה.
לפני שמתחילים
כדי להכין את האפליקציה, קודם צריך לוודא שבקובץ ה-build של האפליקציה נעשה שימוש בערכי הקוד הבאים:
minSdkVersion של 19 או יותר
compileSdkVersion של 28 או יותר
לאחר מכן, מבצעים את השלבים שמפורטים בקטעים הבאים.
הגדרת האפליקציה
בקובץ settings.gradle, צריך לכלול את מאגר Maven של Google ואת מאגר Maven המרכזי גם בקטעי המאגרים dependencyResolutionManagement וגם בקטעי המאגרים pluginManagement:
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-08-17 (שעון UTC).
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 2025-08-17 (שעון 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)"]]