ScreenSync MCP guide

Testing Google Play Integrity API with Claude Code and MCP

Automate Google Play Integrity API testing, StandardIntegrityManager token checks, and IntegrityDialog flows on real Android hardware with Claude Code and MCP.

Minimalist 3D render of an unrooted Android smartphone displaying a violet security shield linked by glowing purple fiber-optic lines to a developer laptop for Google Play Integrity API testing

Modern Android applications handling financial transactions, anti-cheat enforcement, enterprise single sign-on, or premium content rely on the Google Play Integrity API to prove that API requests originate from an unmodified app binary running on a genuine, Google Play Protect-certified device. Yet automating Play Integrity verification inside continuous integration or local test suites routinely breaks down. Standard Android emulators fail hardware-backed MEETS_DEVICE_INTEGRITY and MEETS_STRONG_INTEGRITY checks by design, local sideloaded debug APKs return UNRECOGNIZED_VERSION, and Play Store remediation modals render outside the host application's process boundary where Espresso cannot inspect them. By pairing Claude Code with ScreenSync MCP—an Android and browser Model Context Protocol (MCP) server created by EpsolDev—developers can run deterministic Play Integrity test cycles directly on physical, unrooted Android hardware over a local network.

Key Takeaways

  • Physical unrooted hardware for real verdicts: ScreenSync MCP runs on physical Android 7.0+ devices (com.screensync.mcp), letting Claude Code verify MEETS_BASIC_INTEGRITY, MEETS_DEVICE_INTEGRITY, and MEETS_STRONG_INTEGRITY signals that virtual emulators cannot pass.
  • Separation of capture and control: ScreenSync MCP captures frames using Android's native MediaProjection API (requiring no root and no ADB) at roughly 94 ms median LAN latency, while executing touch, typing, and app-launch controls (control_tap, control_type, control_swipe) through ADB over USB or wireless debugging.
  • Out-of-process IntegrityDialog inspection: When Google Play Services renders a remediation prompt (IntegrityDialogTypeCode.GET_INTEGRITY or GET_STRONG_INTEGRITY), ScreenSync MCP extracts system accessibility trees via get_ui_hierarchy and captures get_logcat telemetry across process boundaries.
  • Unified 226-tool mobile and browser plane: ScreenSync MCP provides 29 phone and desktop tools (12 control_*, 3 os_*, 14 capture/hub) plus 197 web_* browser tools via its Chrome/Edge MV3 extension, enabling end-to-end validation from the phone UI to your backend decodeIntegrityToken service.
  • Strict local-first privacy: Display frames stream from phone to desktop hub over your local network rather than EpsolDev servers, though any screenshot an AI agent explicitly requests is sent to that agent's model provider.

Why Emulators and In-Process Runners Fail Play Integrity Testing

Standard Android emulators and in-process test runners like Espresso or Robolectric fail Google Play Integrity API verification because hardware-backed device attestation requires genuine Play Protect certification and Trusted Execution Environment keys that virtualized environments lack, while out-of-process Play Store remediation dialogs execute outside the application sandbox.

Understanding this failure requires looking at what StandardIntegrityManager actually measures at runtime. Unlike legacy client-side checks that an attacker could hook in memory, Play Integrity delegates signal collection to Google Play Services (com.google.android.gms) and the Google Play Store (com.android.vending). Those privileged system packages inspect bootloader lock state, verified boot integrity, hardware-backed key attestation certificates inside the device's Trusted Execution Environment (TEE) or StrongBox chip, and package installer provenance.

Three distinct failure modes break conventional QA pipelines:

  1. Missing hardware attestation on virtual images: AOSP and standard Android Studio emulator images do not ship with factory-provisioned hardware attestation keys chained to the Google Hardware Attestation Root. Consequently, deviceRecognitionVerdict omits MEETS_DEVICE_INTEGRITY and MEETS_STRONG_INTEGRITY.
  2. Sideloaded APK recognition errors: Installing a debug build directly via adb install produces an appRecognitionVerdict of UNRECOGNIZED_VERSION or UNEVALUATED unless the binary's version code and signing certificate match a release uploaded to a Google Play Console track such as Internal Testing.
  3. Out-of-process remediation modals: Starting with Play Integrity SDK 1.5.0+, developers handle environment errors and weak device verdicts via standardIntegrityManager.showDialog(...). That dialog renders inside com.android.vending, completely outside your app's Activity window. Espresso ViewMatcher assertions throw NoMatchingViewException the moment Play Store owns the foreground window.
Test Environment MEETS_BASIC_INTEGRITY MEETS_DEVICE_INTEGRITY MEETS_STRONG_INTEGRITY appRecognitionVerdict IntegrityDialog Support
Physical unrooted phone (Play Internal Track) Pass (genuine system check) Pass (Play Protect certified) Pass (Android 13+ hardware-backed TEE/StrongBox) PLAY_RECOGNIZED Full Play Store UI flow
Physical unrooted phone (Sideloaded APK) Pass Pass Pass (if hardware supports) UNRECOGNIZED_VERSION Limited / triggers remediation
Standard Android Studio Emulator Conditional (Play Store image only) Fail (no hardware attestation) Fail UNEVALUATED / UNRECOGNIZED_VERSION Often fails or unavailable
Rooted / Unlocked Bootloader Device Fail Fail Fail UNRECOGNIZED_VERSION or PLAY_RECOGNIZED Triggers failure remediation paths

Testing both positive verdicts and negative remediation paths requires physical devices—ideally one certified, unrooted flagship phone signed into a Google Play Console Internal Testing track, and optionally a second test device configured with Play Integrity test-response overrides or an uncertified state to exercise failure dialogs.

How ScreenSync MCP Bridges Claude Code to Physical Android Hardware

ScreenSync MCP connects Claude Code to physical Android 7.0+ phones by streaming live screen frames over local Wi-Fi using Android's MediaProjection API without root or ADB, while routing deterministic tap, swipe, typing, and logcat telemetry commands through a local Node.js 18+ hub over ADB.

When automating Play Integrity workflows, preserving the phone's integrity state is paramount. Any tool that demands su binaries, Magisk modules, or custom Xposed hooks immediately invalidates MEETS_DEVICE_INTEGRITY and MEETS_STRONG_INTEGRITY, turning your test device into a false-negative machine.

ScreenSync MCP avoids modifying the operating system entirely:

  • Capture plane (no root, no ADB): The free ScreenSync MCP Android app (com.screensync.mcp, available on Google Play) uses Android's standard MediaProjection API after explicit user consent per session. Display frames stream directly to the desktop hub over your local LAN with roughly 94 milliseconds median latency in EpsolDev's tests.
  • Control plane (ADB over USB or wireless debugging): Input gestures (control_tap, control_swipe, control_type), app launches, and system log inspection (get_logcat) execute through standard Android Debug Bridge (ADB) channels from the desktop hub. Enabling Developer Options and ADB debugging does not break MEETS_DEVICE_INTEGRITY or MEETS_STRONG_INTEGRITY on a stock, bootloader-locked Android device—unlike unlocking the bootloader or rooting.
  • UI hierarchy & telemetry plane: get_ui_hierarchy reads the active accessibility window tree—even when Google Play's com.android.vending owns the screen during an IntegrityDialog prompt—so Claude Code can read exact button bounds, resource IDs, and error banners without guessing pixel coordinates.
Automation Approach Root Required Handles com.android.vending Dialogs Preserves MEETS_STRONG_INTEGRITY Captures Live get_logcat + Video Local Network Privacy
ScreenSync MCP + Claude Code No (capture needs no ADB; control uses ADB) Yes (get_ui_hierarchy + get_latest_screenshot) Yes (unmodified locked-bootloader phone) Yes (get_logcat + record_screen) Yes (LAN phone-to-hub stream)
Espresso / Robolectric No No (sandboxed to app process) N/A (mocks or local JVM) Partial (no Play Store UI) Local only
Raw ADB Shell Scripts No Brittle (blind coordinate taps) Yes Manual log parsing only Local only
Cloud Device Farms Varies (often shared/modified hosts) Yes, via Appium/UIAutomator Often degraded or shared Play state High latency video External cloud upload

For deeper architectural comparisons across Model Context Protocol mobile bridges, review our breakdown of Android MCP servers and how the ScreenSync MCP screen bridge separates capture from control.

Configuring ScreenSync MCP for Claude Code and Desktop Clients

Developers connect Claude Code to ScreenSync MCP by unpacking the desktop hub, starting the Node.js 18+ local service on port 3000, pairing the Android phone via QR code or mDNS discovery, and registering the stdio entry point in Claude Code's MCP configuration.

Follow the ScreenSync MCP setup guide to install the desktop hub (v1.14.4) alongside the Android app (v2.5.7, Android 7.0+). Once you unpack the hub archive and start it with start-hub.bat (Windows) or start-hub.sh (macOS/Linux), pair your physical Android device by scanning the hub QR code inside the app or letting mDNS auto-discovery resolve the hub on your LAN using your SCREEN_SYNC_TOKEN bearer secret.

Registering ScreenSync MCP in Claude Code

Run the official registration command, pointing to the exact directory where you unpacked the hub zip:

claude mcp add screensync node "/path/to/hub/screensync-hub.js"

Verify that your physical phone appears via ADB (either USB or wireless debugging; if you need cable-free setup, see our guide on Android wireless debugging for MCP servers):

adb devices -l

Configuring Claude Desktop (Optional Companion)

If you also inspect Play Integrity flows from Claude Desktop, add the server entry inside claude_desktop_config.json (accessible via Settings > Developer):

{
  "mcpServers": {
    "screensync": {
      "command": "node",
      "args": ["/path/to/hub/screensync-hub.js"],
      "env": {
        "SCREEN_SYNC_TOKEN": "your-generated-hub-token"
      }
    }
  }
}

For Cursor or VS Code agent mode, check each client's MCP documentation to register the same node "/path/to/hub/screensync-hub.js" stdio command and SCREEN_SYNC_TOKEN environment variable. Note that ChatGPT's web application requires remote HTTPS MCP endpoints and is not supported by local stdio hubs.

Implementing Testable StandardIntegrityManager and IntegrityDialog Flows

A testable Google Play Integrity API client separates token provider warmup from request-bound token generation using StandardIntegrityManager, computes deterministic SHA-256 requestHash payloads for critical API calls, and surfaces remediable verdicts cleanly through StandardIntegrityManager.showDialog while logging diagnostic error codes for get_logcat inspection.

Google recommends StandardIntegrityManager over the legacy Classic API for nearly all interactive app flows because it pre-warms an IntegrityTokenProvider in the background (prepareIntegrityToken), cutting per-request latency down to milliseconds when a user taps a checkout, login, or sensitive action button.

Kotlin Implementation with Structured Telemetry

Instrument your client manager with clear logcat tags so Claude Code can correlate UI transitions captured via get_latest_screenshot with real-time get_logcat entries:

package com.example.integrityqa

import android.app.Activity
import android.content.Context
import android.util.Log
import com.google.android.play.core.integrity.IntegrityManagerFactory
import com.google.android.play.core.integrity.StandardIntegrityException
import com.google.android.play.core.integrity.StandardIntegrityManager
import com.google.android.play.core.integrity.StandardIntegrityManager.PrepareIntegrityTokenRequest
import com.google.android.play.core.integrity.StandardIntegrityManager.StandardIntegrityDialogRequest
import com.google.android.play.core.integrity.StandardIntegrityManager.StandardIntegrityTokenProvider
import com.google.android.play.core.integrity.StandardIntegrityManager.StandardIntegrityTokenRequest
import com.google.android.play.core.integrity.model.IntegrityDialogTypeCode
import java.security.MessageDigest

class PlayIntegrityCoordinator(
    private val context: Context,
    private val cloudProjectNumber: Long
) {
    private val manager: StandardIntegrityManager =
        IntegrityManagerFactory.createStandard(context)

    @Volatile
    private var tokenProvider: StandardIntegrityTokenProvider? = null

    fun warmUpProvider(onReady: (Boolean, String?) -> Unit) {
        val request = PrepareIntegrityTokenRequest.builder()
            .setCloudProjectNumber(cloudProjectNumber)
            .build()

        manager.prepareIntegrityToken(request)
            .addOnSuccessListener { provider ->
                tokenProvider = provider
                Log.i(TAG, "StandardIntegrityTokenProvider prepared successfully")
                onReady(true, null)
            }
            .addOnFailureListener { error ->
                val code = (error as? StandardIntegrityException)?.errorCode
                Log.e(TAG, "Warmup failed code=$code msg=${error.message}")
                onReady(false, "WARMUP_ERROR:$code")
            }
    }

    fun requestBoundToken(
        actionPayload: String,
        onToken: (String) -> Unit,
        onError: (Throwable) -> Unit
    ) {
        val provider = tokenProvider
        if (provider == null) {
            onError(IllegalStateException("IntegrityTokenProvider not warmed up"))
            return
        }

        val requestHash = sha256Hex(actionPayload)
        Log.d(TAG, "Requesting standard integrity token hash=$requestHash")

        val tokenRequest = StandardIntegrityTokenRequest.builder()
            .setRequestHash(requestHash)
            .build()

        provider.request(tokenRequest)
            .addOnSuccessListener { response ->
                val token = response.token()
                Log.i(TAG, "Issued integrity token length=${token.length}")
                onToken(token)
            }
            .addOnFailureListener { error ->
                val code = (error as? StandardIntegrityException)?.errorCode
                Log.e(TAG, "Token request failed code=$code msg=${error.message}")
                onError(error)
            }
    }

    fun launchRemediationDialog(
        activity: Activity,
        exception: StandardIntegrityException,
        requireStrong: Boolean = false,
        onResult: (Int) -> Unit
    ) {
        val dialogType = if (requireStrong) {
            IntegrityDialogTypeCode.GET_STRONG_INTEGRITY
        } else {
            IntegrityDialogTypeCode.GET_INTEGRITY
        }

        val dialogRequest = StandardIntegrityDialogRequest.builder()
            .setActivity(activity)
            .setType(dialogType)
            .setStandardIntegrityResponse(
                StandardIntegrityDialogRequest.StandardIntegrityResponse.ExceptionDetails(exception)
            )
            .build()

        Log.i(TAG, "Launching IntegrityDialog type=$dialogType")
        manager.showDialog(dialogRequest)
            .addOnSuccessListener { responseCode ->
                Log.i(TAG, "IntegrityDialog completed responseCode=$responseCode")
                // Re-warm the provider after user remediation
                tokenProvider = null
                onResult(responseCode)
            }
            .addOnFailureListener { err ->
                Log.e(TAG, "IntegrityDialog failed to open: ${err.message}")
                onResult(-1)
            }
    }

    private fun sha256Hex(input: String): String {
        val digest = MessageDigest.getInstance("SHA-256").digest(input.toByteArray(Charsets.UTF_8))
        return digest.joinToString("") { "%02x".format(it) }
    }

    companion object {
        private const val TAG = "PlayIntegrityQA"
    }
}

Notice two subtle testing requirements encoded above:

  • Re-warming after IntegrityDialog: Once showDialog finishes with a remediation success code, the previously cached StandardIntegrityTokenProvider may still reflect pre-remediation state or expire. Clearing tokenProvider = null and re-running warmUpProvider ensures the next token request reflects the remediated environment.
  • Deterministic requestHash logging: Logging the computed SHA-256 hex digest lets Claude Code verify that the requestHash returned inside the decrypted backend verdict JSON matches the exact action payload triggered on the phone UI, catching replay or parameter-tampering bugs early.

For apps combining Play Integrity with hardware-backed cryptography, pair this coordinator with our guide on testing Android Keystore security with Claude Code and MCP to ensure StrongBox and TEE key attestation work consistently across OEM silicon.

Setting Up Google Play Console Internal Testing and Test Verdict Profiles

Play Integrity testing requires distributing signed builds through a Google Play Console test track and configuring licensed test accounts or custom Play Integrity test responses so your physical device receives deterministic PLAY_RECOGNIZED and simulated failure verdicts without polluting production metrics.

Local debug builds installed straight from Android Studio cannot pass appRecognitionVerdict == "PLAY_RECOGNIZED". Before launching your Claude Code automation loop, complete this prerequisite setup:

  1. Upload an App Bundle (AAB) to Internal Testing: Build a release-signed .aab (or Play App Signing-enrolled bundle) and publish it to the Internal testing track in Google Play Console. Make sure the versionCode matches what you install on your physical test device.
  2. Enable Play Integrity API in Google Cloud & Play Console: Link your Google Cloud Project number (cloudProjectNumber) under Setup > App integrity > Play Integrity API in Google Play Console, and verify the Play Integrity API is enabled in Google Cloud Console.
  3. Register Licensed Testers and Custom Test Responses: Under App integrity > Play Integrity API > Settings > Testing, add your test Gmail accounts. Google Play Console allows configuring per-account or per-device test responses (for example, overriding deviceRecognitionVerdict to return empty/failing verdicts, appRecognitionVerdict to UNRECOGNIZED_VERSION, or simulating PLAY_STORE_VERSION_OUTDATED errors) so you can validate remediation UI and backend rejection paths on a single stock physical phone!
  4. Install via the Internal App Sharing / Internal Track Opt-In URL: Open the opt-in link on the physical Android device logged into the licensed tester Google account and install directly from Google Play Store (com.android.vending).

This parallels the licensing setup described in our guide on testing Android in-app purchases with Claude Code and MCP, where Google Play Console tester tracks govern privileged com.android.vending responses.

Autonomous Claude Code + ScreenSync MCP Verification Workflow

Claude Code executes end-to-end Play Integrity QA by driving the physical Android app through ADB controls, inspecting real-time get_logcat telemetry and out-of-process get_ui_hierarchy trees, capturing visual evidence via get_latest_screenshot and record_screen, and validating server-side verdict decryption with ScreenSync's browser tools.

Here is the concrete four-phase testing loop you can run directly inside Claude Code once your physical phone is paired to the ScreenSync MCP hub.

Phase 1: Cold-Start Provider Warmup and Logcat Verification

Ask Claude Code to launch your Internal Testing build, observe the startup screen, and confirm prepareIntegrityToken succeeds without transient network errors. Claude Code invokes control_tap or ADB app launch, inspects get_logcat, and checks get_ui_hierarchy for ready state.

If a warmup error occurs, Claude Code cross-references the exact StandardIntegrityException integer error code against the remediation table below:

Error Constant / Scenario Typical Root Cause Expected App Behavior Claude Code MCP Triage Action
PLAY_STORE_NOT_FOUND / PLAY_STORE_ACCOUNT_NOT_FOUND Play Store missing, disabled, or no signed-in Google account Prompt user or invoke IntegrityDialog (GET_INTEGRITY) Read get_ui_hierarchy for fallback dialog; verify Play account via get_logcat
PLAY_STORE_VERSION_OUTDATED / PLAY_SERVICES_VERSION_OUTDATED Stale com.android.vending or com.google.android.gms Trigger showDialog to route user to Play Store update Use get_latest_screenshot to confirm IntegrityDialog overlay opens cleanly
NETWORK_ERROR / TRANSIENT_ERROR Offline state, captive portal, or temporary Google RPC fault Exponential backoff retry; never silently grant access Combine with airplane-mode / network throttling checks via ADB + get_logcat
TOO_MANY_REQUESTS Exceeded daily Play Integrity API call quota or rapid token loop Honor Retry-After / debounce token requests Inspect get_logcat timestamps to catch unintended tight retry loops
CLOUD_PROJECT_NUMBER_IS_INVALID Mismatched or missing cloudProjectNumber in PrepareIntegrityTokenRequest Fail closed and log configuration error Check get_logcat for WARMUP_ERROR, inspect BuildConfig in repo, and patch immediately

For testing network failures and exponential backoff behavior deterministically, see our companion workflow on testing Android network resilience with Claude Code and MCP.

Phase 2: Driving Protected Actions and Capturing IntegrityDialog Overlays

Next, instruct Claude Code to trigger the protected flow in your app—such as signing in, redeeming a voucher, or initiating a sensitive transfer:

Using ScreenSync MCP on the connected Pixel phone:
1. Call record_screen to start recording the session.
2. Inspect get_ui_hierarchy and tap the "Verify Device & Continue" button with control_tap.
3. Immediately call get_logcat filtering for tag "PlayIntegrityQA" to verify the SHA-256 requestHash and token issuance.
4. If Google Play renders an IntegrityDialog modal (package com.android.vending), capture get_latest_screenshot and get_ui_hierarchy, verify the remediation copy, and confirm our app does not crash if the user dismisses it.

Because get_ui_hierarchy queries Android's system accessibility dump rather than an in-process Espresso view tree, Claude Code sees every button inside com.android.vending when IntegrityDialog appears, can tap Cancel or Update, and can confirm your Activity handles IntegrityDialogResponseCode.DIALOG_CANCELLED gracefully without crashing or hanging on a loading spinner.

Phase 3: Cross-Surface Backend Decryption Verification with web_* Browser Tools

Play Integrity tokens are opaque encrypted/signed blobs on the client; only your backend server can decrypt and trust the verdict by calling Google's playintegrity.v1.decodeIntegrityToken endpoint. A complete test must verify that the backend parses requestDetails.requestHash, appIntegrity.appRecognitionVerdict, deviceIntegrity.deviceRecognitionVerdict, and accountDetails.appLicensingVerdict accurately.

Here is a reference Node.js/TypeScript backend verification helper that Claude Code can inspect, test, or validate against your staging server logs:

import { google } from "googleapis";
import crypto from "node:crypto";

interface IntegrityVerificationResult {
  allowed: boolean;
  reason: string;
  verdicts: string[];
  appVerdict: string | undefined;
}

export async function verifyPlayIntegrityToken(
  packageName: string,
  integrityToken: string,
  expectedActionPayload: string
): Promise<IntegrityVerificationResult> {
  const auth = new google.auth.GoogleAuth({
    scopes: ["https://www.googleapis.com/auth/playintegrity"],
  });

  const playintegrity = google.playintegrity({ version: "v1", auth });

  const response = await playintegrity.v1.decodeIntegrityToken({
    packageName,
    requestBody: { integrityToken },
  });

  const payload = response.data.tokenPayloadExternal;
  if (!payload) {
    return { allowed: false, reason: "EMPTY_PAYLOAD", verdicts: [], appVerdict: undefined };
  }

  // 1. Verify package name & requestHash to block token replay attacks
  const expectedHash = crypto
    .createHash("sha256")
    .update(expectedActionPayload, "utf8")
    .digest("hex");

  if (payload.requestDetails?.requestPackageName !== packageName) {
    return { allowed: false, reason: "PACKAGE_MISMATCH", verdicts: [], appVerdict: undefined };
  }

  if (payload.requestDetails?.requestHash !== expectedHash) {
    return { allowed: false, reason: "REQUEST_HASH_MISMATCH", verdicts: [], appVerdict: undefined };
  }

  // 2. Enforce token freshness (e.g., reject tokens older than 120 seconds)
  const tokenAgeMs = Date.now() - Number(payload.requestDetails?.timestampMillis ?? 0);
  if (tokenAgeMs > 120_000 || tokenAgeMs < -30_000) {
    return { allowed: false, reason: "STALE_TOKEN", verdicts: [], appVerdict: undefined };
  }

  // 3. Enforce app & device integrity
  const appVerdict = payload.appIntegrity?.appRecognitionVerdict;
  const deviceVerdicts = payload.deviceIntegrity?.deviceRecognitionVerdict ?? [];

  const meetsDevice = deviceVerdicts.includes("MEETS_DEVICE_INTEGRITY");
  if (appVerdict !== "PLAY_RECOGNIZED" || !meetsDevice) {
    return {
      allowed: false,
      reason: "INSUFFICIENT_INTEGRITY",
      verdicts: deviceVerdicts,
      appVerdict,
    };
  }

  return {
    allowed: true,
    reason: "VERIFIED",
    verdicts: deviceVerdicts,
    appVerdict,
  };
}

With ScreenSync MCP's Chrome/Edge MV3 browser extension (view extension guide), Claude Code can use its 197 web_* browser tools to inspect your staging observability dashboard, API explorer, or Play Console test configuration inside your real authenticated browser tab (with a human approval prompt before any risky browser action), confirming the server-side verdict matches the physical device's exact requestHash in get_logcat.

Phase 4: Negative Testing Play Integrity Failure and Remediation Paths

Testing only the happy path (PLAY_RECOGNIZED + MEETS_DEVICE_INTEGRITY) leaves production apps vulnerable to infinite retry loops, unhandled StandardIntegrityException crashes, or broken UX when a real user's Play Store cache is corrupted or their device fails integrity checks.

Use Google Play Console's Play Integrity test responses feature to assign a simulated failure profile to your test Gmail account:

  • Simulate UNRECOGNIZED_VERSION: Verify your backend returns HTTP 403 with a structured error code rather than a 500 crash, and confirm your Android UI displays a clear "Download from Google Play" recovery screen.
  • Simulate deviceRecognitionVerdict: [] (failed device check): Confirm your app invokes IntegrityDialog (GET_INTEGRITY) when appropriate, handles cancellation (DIALOG_CANCELLED), and gracefully degrades non-critical features if your policy allows tiered access.
  • Simulate stale timestampMillis replay: Ask Claude Code to capture a valid token from get_logcat, replay it against your staging API after two minutes via curl, and confirm your backend rejects it with STALE_TOKEN.

If your app pairs Play Integrity checks with passkeys or hardware-backed login challenges, combine this workflow with our guide on testing Android passkeys with Claude Code and MCP to verify full-stack authentication resilience.

Privacy, Security, and CI Hygiene for Play Integrity Automation

ScreenSync MCP maintains strict local data locality by streaming MediaProjection frames directly between your physical Android device and your local desktop hub over your own network without touching EpsolDev servers, while requiring developers to treat screenshots sent to external AI model providers as sensitive telemetry.

When testing Play Integrity flows, keep three operational safeguards in place:

  • Redact raw tokens in shared artifacts: A valid Play Integrity JWE token is tied to a real device and timestamp; even though it is encrypted for Google's servers, avoid committing raw get_logcat dumps containing production cloudProjectNumber IDs or live tokens into public repositories.
  • Model provider screenshot awareness: While ScreenSync MCP never routes frames through EpsolDev servers (Drive fallback is optional), any screenshot requested via get_latest_screenshot is transmitted to the connected AI agent's model provider (such as Anthropic when using Claude Code). Keep sensitive user credentials or real payment PANs off-screen during automated runs. For more details, read our deep dive on security and privacy architecture in mobile screen MCP servers.
  • Rate-limit automated warmup loops: Calling prepareIntegrityToken or request inside tight retry loops during flaky UI tests can trip Play Integrity daily quotas (TOO_MANY_REQUESTS). Instruct Claude Code to assert warmup counts in get_logcat so prepareIntegrityToken runs once per app session or after explicit IntegrityDialog remediation.

Ready to Test Play Integrity on Real Android Hardware?

Stop fighting false-negative emulator failures and blind Espresso crashes on Play Store remediation dialogs. Download the free ScreenSync MCP Android app on Google Play, explore the ScreenSync MCP developer platform, and run your first Claude Code StandardIntegrityManager verification pass on physical Android hardware in minutes.

Next steps

FAQ

Questions, answered

Why does Google Play Integrity API fail on standard Android emulators?

Standard Android emulators lack factory-provisioned hardware attestation keys chained to the Google Hardware Attestation Root inside a physical Trusted Execution Environment or StrongBox chip. As a result, deviceRecognitionVerdict omits MEETS_DEVICE_INTEGRITY and MEETS_STRONG_INTEGRITY, requiring physical unrooted Android hardware or Google Play Games for PC test environments for valid verdicts.

Does ScreenSync MCP require root access to test Play Integrity API?

No. ScreenSync MCP captures your Android 7.0+ screen using Android's native MediaProjection API after session consent, requiring zero root access and zero ADB for capture. Control actions such as control_tap and get_logcat run over standard ADB debugging, which preserves stock locked-bootloader Play Integrity device verdicts.

Can Claude Code interact with Google Play IntegrityDialog system modals?

Yes. Because IntegrityDialog renders inside Google Play Store's com.android.vending process, Espresso cannot query its views. ScreenSync MCP extracts system-wide accessibility trees via get_ui_hierarchy and live frames via get_latest_screenshot, allowing Claude Code to read remediation prompts, tap buttons, and verify cancellation handling.

Why does a sideloaded debug APK return UNRECOGNIZED_VERSION in Play Integrity?

Google Play Integrity evaluates your app's package name, version code, and signing certificate against releases distributed through Google Play Console. A local APK installed directly via adb install is unknown to Google Play, returning UNRECOGNIZED_VERSION. Upload a release-signed bundle to Internal Testing and install from Play Store.

How many tools does ScreenSync MCP expose to Claude Code and browser workflows?

ScreenSync MCP provides 226 MCP tools in total: 29 phone and desktop tools (12 control_*, 3 os_*, and 14 capture and hub tools including get_latest_screenshot, get_ui_hierarchy, get_logcat, and record_screen) plus 197 web_* browser tools through its Chrome and Edge MV3 extension.

How do I test negative Play Integrity verdicts without rooting my phone?

Use Google Play Console's built-in Play Integrity testing settings under App integrity. You can register licensed test Gmail accounts and configure custom test verdict overrides—such as empty deviceRecognitionVerdict arrays or PLAY_STORE_VERSION_OUTDATED errors—so your unrooted physical device triggers failure and IntegrityDialog paths deterministically.

What happens to screenshots captured during Play Integrity testing with Claude Code?

ScreenSync MCP streams display frames from your Android device to your local Node.js hub over your own LAN without passing through EpsolDev servers (Drive fallback is optional). However, any screenshot requested by Claude Code via get_latest_screenshot is sent to that agent's model provider for vision analysis.

How do I verify that requestHash prevents Play Integrity token replay attacks?

Before calling StandardIntegrityTokenProvider.request, compute a SHA-256 hash of the specific API request payload and pass it to setRequestHash. In your backend decodeIntegrityToken handler, recompute the expected SHA-256 hash and reject mismatches or stale timestampMillis values, while verifying logcat requestHash output via get_logcat.

Written by

ScreenSync MCP team

The ScreenSync MCP team at EpsolDev builds the Android app, the desktop MCP hub and the browser extension that let AI agents see and control a real phone. These guides come out of that work.