SafetyNet Verify Apps API  |  Security  |  Android Developers Skip to main content Essentials Build AI experiences Build AI-powered Android apps with Gemini APIs and more. Get started Get started Create your first app. Use Compose for UI and adaptive app development to support multiple device form factors. Hello, world! Developer Verification Adaptive apps Compose for UI AI-powered IDE Training Monetization with Play ↗️ Optimize by form factor Build apps that optimize the user experience on phones, tablets, foldables, cars, XR, and more. Phones, tablets, foldables Android for Cars Android TV Android XR Googlebook ChromeOS Wear OS Build by category Learn to build for your use case by following Google's prescriptive and opinionated guidance. Games Camera & media Social & messaging Health & fitness Productivity Enterprise apps Get the latest Stay in touch with the latest releases throughout the year, join our preview programs, and give us your feedback. Latest updates Experimental updates Android Studio preview Jetpack & Compose libraries Wear OS releases Privacy Sandbox ↗️ Design & Plan Excellent Experiences Build the best experiences for your best users. Learn more UI Design Design a beautiful user interface using Android best practices. Design for Android Mobile Desktop experiences XR Headsets & XR Glasses AI Glasses Widgets Wear OS Android TV Android for Cars Architecture Design robust, testable, and maintainable app logic and services. Introduction Libraries Navigation Modularization Testing Kotlin Multiplatform Quality Plan for app quality and align with Play store guidelines. Overview Core value User experience Accessibility Technical quality Excellent Experiences Security Safeguard users against threats and ensure a secure Android experience. Overview Privacy Permissions Identity Fraud prevention Develop Gemini in Android Studio Your AI development companion for Android development. Learn more Get Android Studio Core areas Get the samples and docs for the features you need. Samples Multidevice support User interfaces Background work Data and files Connectivity All core areas ⤵️ Tools and workflow Use the IDE to write and build your app, or create your own pipeline. Write and debug code Build projects Test your app Performance Command-line tools Gradle plugin API Android Bench Device tech Write code for form factors. Connect devices and share data. Phones, tablets, foldables ChromeOS Android for Cars Android TV Android XR Wear OS Android Health Better Together All devices ⤵️ Libraries Browse API reference documentation with all the details. Android platform Jetpack libraries Compose libraries Google Play services ↗️ Google Play SDK index ↗️ Google Play Play Console Publish your app or game and grow your business on Google Play. Go to Play Console Learn more ↗️ Fundamentals Learn how to engage users, monitize, and secure your app. Play Monetization Play Integrity Play Policies Play Programs ↗️ Games Dev Center Develop and deliver games. Get tools, downloads, and samples. Overview Play Asset Delivery Play Games Services Play Games on PC Level Up guidelines All Play guides ⤵️ Libraries Browse API reference documentation with all the details. Play Feature Delivery Play In-app Updates Play In-app Reviews Play Install Referrer Google Play services ↗️ Google Play SDK index ↗️ All Play libraries ⤵️ Tools & resources Tools for publishing, promoting, and managing your app. Android App Bundles Brand & marketing Play Console APIs ↗️ Blog the Android Developer's Blog Read the latest Explore the authors → Explore categories Case Studies Real-world results from real-world users. Explore how different teams use our tools to achieve their goals. Events & Programs Get the details on upcoming webinars, workshops, meetups, and special initiatives designed to help you grow. Product News Stay in the loop with the latest updates, feature releases, and behind-the-scenes looks at how we’re evolving. Community Discover stories from our users, spotlight features, and the collaborative projects that bring us all together. How-tos From quick tips to deep-dive tutorials, these step-by-step guides are designed to help you work smarter and faster. / English Deutsch Español – América Latina Français Indonesia Italiano Polski Português – Brasil Tiếng Việt Türkçe Русский עברית العربيّة فارسی हिंदी বাংলা ภาษาไทย 中文 – 简体 中文 – 繁體 日本語 한국어 Android Studio Sign in Security Essentials More Design & Plan More Develop More Google Play More Blog More Android Studio Build AI experiences Get started Get started Hello, world! Developer Verification Adaptive apps Compose for UI AI-powered IDE Training Monetization with Play ↗️ Optimize by form factor Phones, tablets, foldables Android for Cars Android TV Android XR Googlebook ChromeOS Wear OS Build by category Games Camera & media Social & messaging Health & fitness Productivity Enterprise apps Get the latest Latest updates Experimental updates Android Studio preview Jetpack & Compose libraries Wear OS releases Privacy Sandbox ↗️ Excellent Experiences Learn more UI Design Design for Android Mobile Desktop experiences XR Headsets & XR Glasses AI Glasses Widgets Wear OS Android TV Android for Cars Architecture Introduction Libraries Navigation Modularization Testing Kotlin Multiplatform Quality Overview Core value User experience Accessibility Technical quality Excellent Experiences Security Overview Privacy Permissions Identity Fraud prevention Gemini in Android Studio Learn more Get Android Studio Core areas Samples Multidevice support User interfaces Background work Data and files Connectivity All core areas ⤵️ Tools and workflow Write and debug code Build projects Test your app Performance Command-line tools Gradle plugin API Android Bench Device tech Phones, tablets, foldables ChromeOS Android for Cars Android TV Android XR Wear OS Android Health Better Together All devices ⤵️ Libraries Android platform Jetpack libraries Compose libraries Google Play services ↗️ Google Play SDK index ↗️ Play Console Go to Play Console Learn more ↗️ Fundamentals Play Monetization Play Integrity Play Policies Play Programs ↗️ Games Dev Center Overview Play Asset Delivery Play Games Services Play Games on PC Level Up guidelines All Play guides ⤵️ Libraries Play Feature Delivery Play In-app Updates Play In-app Reviews Play Install Referrer Google Play services ↗️ Google Play SDK index ↗️ All Play libraries ⤵️ Tools & resources Android App Bundles Brand & marketing Play Console APIs ↗️ the Android Developer's Blog Read the latest Explore the authors → Explore categories Case Studies Events & Programs Product News Community How-tos Android Developers Security SafetyNet Verify Apps API Stay organized with collections Save and categorize content based on your preferences. Note: We recommend using the Play Integrity API to check the status of Play Protect on a device because it offers several benefits over the SafetyNet Verify Apps API. Learn more. The SafetyNet Verify Apps API, a library powered by Google Play services, lets your app interact programmatically with the Verify Apps feature on a device, protecting the device against potentially harmful apps. If your app handles sensitive user data, such as financial information, it's important to confirm that the user's device is protected against malicious apps and doesn't have any apps that could impersonate your app or perform other malicious actions. If the device's security doesn't meet the minimum security posture, you can disable functionality within your own app to reduce the danger to the user. As part of its continuing commitment to make the Android ecosystem as safe as possible, Google monitors and profiles the behavior of Android apps. If the Verify Apps feature detects a potentially dangerous app, all users who have installed the app are notified and encouraged to promptly uninstall the app. This process protects the security and privacy of these users. The SafetyNet Verify Apps API lets you leverage this feature to protect your app's data. By using this API, you can determine whether a user's device is protected by the Verify Apps feature, encourage users who aren't already using the feature to opt in to its protection, and identify any known potentially harmful apps that are installed on the device. Additional terms of service By accessing or using the SafetyNet APIs, you agree to the Google APIs Terms of Service and to the following Verify Apps API Terms of Service. Please read and understand all applicable terms and policies before accessing the APIs. Verify Apps API Terms of Service The analyses of apps that identify potential harmful apps may yield both false positives and false negatives. The results (or lack thereof) returned from this API suite are presented to the best of our understanding. You acknowledge and understand that the results returned by this SafetyNet API suite are not guaranteed to be accurate at all times. Add the SafetyNet API dependency Before using the Verify Apps API, add the SafetyNet API to your project. If you are using Android Studio, add this dependency to your app-level Gradle file. For more information, see SafetyNet API setup. Enable app verification The SafetyNet Verify Apps API provides two methods for enabling the Verify Apps feature. You can determine whether app verification is enabled using isVerifyAppsEnabled(), and you can request enabling of app verification using enableVerifyApps(). The difference between these two methods is that while isVerifyAppsEnabled() reports the current status of the Verify Apps feature, enableVerifyApps() explicitly asks the user for consent to use the feature. If you want your app to just be aware of the feature's status to make a security-driven decision, your app should call isVerifyAppsEnabled(). However, if you want to be sure that your app can list potentially harmful installed apps, you should call enableVerifyApps() instead. Determine whether app verification is enabled The asynchronous isVerifyAppsEnabled() method lets your app determine whether the user is enrolled in the Verify Apps feature. This method returns a VerifyAppsUserResponse object, which contains information regarding all actions that the user has taken related to the Verify Apps feature, including enabling it. The following code snippet shows how to create the callback associated with this method: Kotlin SafetyNet.getClient(this) .isVerifyAppsEnabled .addOnCompleteListener { task -> if (task.isSuccessful) { if (task.result.isVerifyAppsEnabled) { Log.d("MY_APP_TAG", "The Verify Apps feature is enabled.") } else { Log.d("MY_APP_TAG", "The Verify Apps feature is disabled.") } } else { Log.e("MY_APP_TAG", "A general error occurred.") } } Java SafetyNet.getClient(this) .isVerifyAppsEnabled() .addOnCompleteListener(new OnCompleteListener<VerifyAppsUserResponse>() { @Override public void onComplete(Task<VerifyAppsUserResponse> task) { if (task.isSuccessful()) { VerifyAppsUserResponse result = task.getResult(); if (result.isVerifyAppsEnabled()) { Log.d("MY_APP_TAG", "The Verify Apps feature is enabled."); } else { Log.d("MY_APP_TAG", "The Verify Apps feature is disabled."); } } else { Log.e("MY_APP_TAG", "A general error occurred."); } } }); Request enabling of app verification The asynchronous enableVerifyApps() method lets your app invoke a dialog requesting that the user enable the Verify Apps feature. This method returns a VerifyAppsUserResponse object, which contains information regarding all actions that the user has taken related to the Verify Apps feature, including whether they've given consent to enable it. The following code snippet shows how to create the callback associated with this method: Kotlin SafetyNet.getClient(this) .enableVerifyApps() .addOnCompleteListener { task -> if (task.isSuccessful) { if (task.result.isVerifyAppsEnabled) { Log.d("MY_APP_TAG", "The user gave consent to enable the Verify Apps feature.") } else { Log.d( "MY_APP_TAG", "The user didn't give consent to enable the Verify Apps feature." ) } } else { Log.e("MY_APP_TAG", "A general error occurred.") } } Java SafetyNet.getClient(this) .enableVerifyApps() .addOnCompleteListener(new OnCompleteListener<VerifyAppsUserResponse>() { @Override public void onComplete(Task<VerifyAppsUserResponse> task) { if (task.isSuccessful()) { VerifyAppsUserResponse result = task.getResult(); if (result.isVerifyAppsEnabled()) { Log.d("MY_APP_TAG", "The user gave consent " + "to enable the Verify Apps feature."); } else { Log.d("MY_APP_TAG", "The user didn't give consent " + "to enable the Verify Apps feature."); } } else { Log.e("MY_APP_TAG", "A general error occurred."); } } }); Your app can encounter one or more unusual conditions when using this method: If the Verify Apps feature is already enabled, the dialog doesn't appear, and the API behaves as if the user gave consent to enable this feature. If the user navigates away from the dialog, the dialog is destroyed, and the API assumes that the user didn't give consent to enable this feature. If your app and another app call this method simultaneously, only one dialog appears, and all apps receive identical return values from the method. List potentially harmful installed apps The asynchronous listHarmfulApps() method lets you obtain a list of any known potentially harmful apps that the user has installed on their device. This list includes categories for the identified potentially harmful apps so that your app can take appropriate action. Note: This method provides only the potentially harmful apps that are associated with the currently active user or account. The following code snippet shows how to create the callback associated with this method: Kotlin SafetyNet.getClient(this) .listHarmfulApps() .addOnCompleteListener { task -> Log.d(TAG, "Received listHarmfulApps() result") if (task.isSuccessful) { val result = task.result val scanTimeMs = result.lastScanTimeMs val appList = result.harmfulAppsList if (appList?.isNotEmpty() == true) { Log.e("MY_APP_TAG", "Potentially harmful apps are installed!") for (harmfulApp in appList) { Log.e("MY_APP_TAG", "Information about a harmful app:") Log.e("MY_APP_TAG", " APK: ${harmfulApp.apkPackageName}") Log.e("MY_APP_TAG", " SHA-256: ${harmfulApp.apkSha256}") // Categories are defined in VerifyAppsConstants. Log.e("MY_APP_TAG", " Category: ${harmfulApp.apkCategory}") } } else { Log.d("MY_APP_TAG", "There are no known potentially harmful apps installed.") } } else { Log.d( "MY_APP_TAG", "An error occurred. Call isVerifyAppsEnabled() to ensure that the user " + "has consented." ) } } Java SafetyNet.getClient(this) .listHarmfulApps() .addOnCompleteListener(new OnCompleteListener<HarmfulAppsResponse>() { @Override public void onComplete(Task<HarmfulAppsResponse> task) { Log.d(TAG, "Received listHarmfulApps() result"); if (task.isSuccessful()) { HarmfulAppsResponse result = task.getResult(); long scanTimeMs = result.getLastScanTimeMs(); List<HarmfulAppsData> appList = result.getHarmfulAppsList(); if (appList.isEmpty()) { Log.d("MY_APP_TAG", "There are no known " + "potentially harmful apps installed."); } else { Log.e("MY_APP_TAG", "Potentially harmful apps are installed!"); for (HarmfulAppsData harmfulApp : appList) { Log.e("MY_APP_TAG", "Information about a harmful app:"); Log.e("MY_APP_TAG", " APK: " + harmfulApp.apkPackageName); Log.e("MY_APP_TAG", " SHA-256: " + harmfulApp.apkSha256); // Categories are defined in VerifyAppsConstants. Log.e("MY_APP_TAG", " Category: " + harmfulApp.apkCategory); } } } else { Log.d("MY_APP_TAG", "An error occurred. " + "Call isVerifyAppsEnabled() to ensure " + "that the user has consented."); } } }); 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 2026-03-06 UTC. [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-03-06 UTC."],[],[]] X Follow @AndroidDev on X YouTube Check out Android Developers on YouTube LinkedIn Connect with the Android Developers community on LinkedIn More Android Android Android for Enterprise Security Source News Blog Podcasts Discover Gaming Machine Learning Health & Fitness Camera & Media Privacy 5G Android Devices Large screens Wear OS ChromeOS devices Android for cars Android TV Releases Android 17 Android 16 Android 15 Android 14 Android 13 Android 12 Android 11 Documentation and Downloads Android Studio guide Developers guides API reference Download Studio Android NDK Support Report platform bug Report documentation bug Google Play support Join research studies Android Chrome Firebase Google Cloud Platform All products Privacy License Brand guidelines Manage cookies Get news and tips by email Subscribe English Deutsch Español – América Latina Français Indonesia Italiano Polski Português – Brasil Tiếng Việt Türkçe Русский עברית العربيّة فارسی हिंदी বাংলা ภาษาไทย 中文 – 简体 中文 – 繁體 日本語 한국어