Writing

expo-screen-capture and READ_MEDIA_IMAGES: the Play fix that crashed Android 14

By Mohamed Gado · · 4 min read

Nafis, my gold and precious-metals app, has an opt-in "secure screen" setting that hides the app from screenshots and the recent-apps preview. It uses expo-screen-capture. On 27 August 2026 Google Play refused an upload because of a photo permission the app never asked for. I blocked the permission, plus its sibling, and the next upload went through. The day after, that release crashed on launch for every Android 14+ user. Here's the chain, and how to block expo-screen-capture's permissions without the crash.

Play rejects READ_MEDIA_IMAGES#

The rejection said:

All developers requesting access to the photo and video permissions are required to tell Google Play about the core functionality of their app.

Nafis doesn't read photos. The permission came from expo-screen-capture, which declares READ_MEDIA_IMAGES for its screenshot listener (addScreenshotListener). On Android 13 and below, it detects a screenshot by watching the media store for new images. Nafis only calls preventScreenCaptureAsync(), which sets FLAG_SECURE on the window and needs no permission at all:

useEffect(() => {
  if (secureScreen) void preventScreenCaptureAsync().catch(() => {})
  else void allowScreenCaptureAsync().catch(() => {})
}, [secureScreen])

So I added the library's permissions to blockedPermissions in app.json: READ_MEDIA_IMAGES, and also DETECT_SCREEN_CAPTURE, the Android 14 half of the same listener. The upload was accepted.

Checking the manifest: read the AAB, not the installed app#

Before resubmitting, I wanted to confirm the permission was gone. adb shell dumpsys package on the installed app didn't list READ_MEDIA_IMAGES, but it didn't list it for the old build either. The library declares it with maxSdkVersion="33", so on a newer phone the package manager drops it at install time.

Play reads the bundle, so check the bundle. Unzip the .aab and read base/manifest/AndroidManifest.xml. In a bundle it's a protobuf file, so use bundletool, or aapt2 dump xmltree on the APK it produces. That's the manifest Play's review sees.

Every Android 14 launch crashes#

The release built, uploaded and shipped. It also crashed on open for every user on Android 14 or newer. Logcat:

FATAL EXCEPTION: expo-updates-error-recovery
java.lang.SecurityException: Permission Denial: registerScreenCaptureObserver
  requires android.permission.DETECT_SCREEN_CAPTURE
    at android.app.Activity.registerScreenCaptureCallback(Activity.java:10037)

I'd decided what to block by reading my own code, which never adds a screenshot listener. The library's code is what matters. On Android 14+, expo-screen-capture's native module registers a screen-capture callback as soon as the module is created, and again whenever the activity comes to the foreground. It doesn't wait for JavaScript to ask, and it doesn't catch a failure:

OnCreate {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
    screenCaptureCallback = Activity.ScreenCaptureCallback { emitEvent() }
    registerCallback() // calls Activity.registerScreenCaptureCallback
  } else {
    screenshotEventEmitter = ScreenshotEventEmitter(context) { emitEvent() }
  }
}
 
OnActivityEntersForeground {
  registerCallback()
  screenshotEventEmitter?.onHostResume()
}

registerScreenCaptureCallback needs DETECT_SCREEN_CAPTURE. With that permission blocked, Android throws a SecurityException, nothing catches it, and the app dies at launch. On Android 13 and below the library uses the older media-store path, which swallows its own failures. That's why the crash hit Android 14+ only.

My first suspect was something else in the same commit, an Updates.reloadAsync() call, because the exception's thread was named expo-updates-error-recovery. The stack trace named the real cause in one line, once I reproduced the crash with a release build on an emulator.

The fix: block one permission, keep the other#

DETECT_SCREEN_CAPTURE is a normal permission, granted at install without a prompt, and Play doesn't ask about it. Only READ_MEDIA_IMAGES triggers the photo-and-video declaration. So the fix was to unblock one line:

"android": {
  "blockedPermissions": [
    "android.permission.READ_MEDIA_IMAGES"
  ]
}

With READ_MEDIA_IMAGES blocked, the Android 13-and-below listener fails quietly, and the app never uses it anyway. With DETECT_SCREEN_CAPTURE declared, the Android 14 registration succeeds. preventScreenCaptureAsync() works on both, since FLAG_SECURE never needed either permission.

The process gaps that let it ship#

  • No release build was launched before submitting. The release went out 16 minutes after the commit, and the crash only exists in a build where the permission is actually missing. A single launch on an Android 14 device or emulator would have caught it. My release checklist now has that step.
  • Build and submit were one command. When Play rejected the first upload, the whole build was thrown away. Splitting build, verify and submit turned the retry from a 15-minute rebuild into a 2-minute upload.
  • Play Vitals looked clean after 7 hours. Crash reporting lags. An empty dashboard on release day doesn't mean the release is fine.

Takeaways#

  • blockedPermissions removes a permission your dependencies may use without asking you. Read where the library uses it before blocking it.
  • expo-screen-capture registers its Android 14 screenshot callback at startup, whether or not you add a listener. Keep DETECT_SCREEN_CAPTURE, and block only READ_MEDIA_IMAGES if Play asks.
  • Check permissions in the .aab manifest. An installed app's dumpsys hides permissions with a maxSdkVersion.
  • A crash that only hits some Android versions usually lines up with an SDK check in some library's native code.
  • Launch the release build once before you submit it.