What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
On Android 14 (API level 34) and newer, detect a screenshot of a visible activity with Activity.ScreenCaptureCallback. Declare the install-time android.permission.DETECT_SCREEN_CAPTURE permission, register the callback in onStart(), and unregister it in onStop(). The callback reports that a capture occurred; it does not provide the screenshot pixels or the capturer’s identity.
The supported Android screenshot-detection API
Android 14 introduced a privacy-preserving, per-activity callback for screenshot detection. It is intended for an app that wants to react after a user captures the activity currently visible on screen—for example, by recording an internal event, refreshing sensitive content, or showing guidance.
- Minimum platform: Android 14, API level 34.
- Permission:
android.permission.DETECT_SCREEN_CAPTURE, declared in the manifest. It is an install-time permission, not a runtime dialog. - Scope: one
Activitywhile that activity is visible. - Signal:
onScreenCaptured()is invoked after a supported screenshot event. - Data: the callback contains no image and no information identifying the person or app that initiated the capture.
Android displays a system notice for each detection signal, so explain the behavior in your privacy or in-app documentation.
Implement detection in Kotlin
1. Declare the permission
Add this element outside the <application> element in AndroidManifest.xml:
#1 Best Overall
- YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
- LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
- MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
- NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
- BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.
<manifest ...>
<uses-permission android:name="android.permission.DETECT_SCREEN_CAPTURE" />
<application ...>
...
</application>
</manifest>
The declaration makes the capability available when the app is installed. There is no separate runtime permission request to launch.
2. Create and register the callback
Keep one callback instance per activity and tie registration to the activity lifecycle:
import android.app.Activity
import android.os.Build
import android.os.Bundle
import android.util.Log
class SensitiveActivity : Activity() {
private val screenCaptureCallback =
Activity.ScreenCaptureCallback {
// This activity was captured while visible.
Log.i("SensitiveActivity", "Screen capture detected")
// Record an event or update app state here.
}
override fun onStart() {
super.onStart()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
registerScreenCaptureCallback(mainExecutor, screenCaptureCallback)
}
}
override fun onStop() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
unregisterScreenCaptureCallback(screenCaptureCallback)
}
super.onStop()
}
}
Activity.ScreenCaptureCallback and onScreenCaptured() were added in API 34. The version guard keeps the same binary usable on older Android releases, where this standardized callback does not exist. Registering in onStart() limits monitoring to the activity’s visible lifetime; unregistering in onStop() prevents a stopped activity from retaining a callback.
3. Decide what your handler does
The handler should use information your app already owns. Typical actions include logging a timestamp against the current account, marking a screen as shared, or replacing a one-time secret that was displayed. Do not attempt to read pixels from the callback, infer who took the screenshot, or treat the callback as a media stream.
Rank #2
- Carrier: This phone is locked to Tracfone, which means this device can only be used on the Tracfone wireless network. Tracfone plan required, activating is easy, just 3 steps.
- DISPLAY: Immersive viewing on a 6.7-inch super-bright 120Hz display with powerful stereo speakers and Bass Boost for cinematic entertainment.
- CAMERA SYSTEM: Advanced 50MP Quad Pixel camera captures sharp, detailed photos and videos in any lighting condition
- PERFORMANCE: Lightning-fast 5G connectivity paired with a powerful processor and RAM Boost for smooth multitasking.
- BATTERY LIFE: Long-lasting 5000mAh battery with TurboPower charging technology delivers hours of power in minutes.
Coverage and limitations
What is detected
The callback is activity-scoped and runs when the monitored, visible activity is captured through the supported Android screenshot mechanism. It is a notification that a capture occurred, not a copy of the resulting file.
What is not detected
Android’s documentation specifically excludes screenshots made with ADB commands and instrumentation tests that capture screen contents. A recording or cast started through MediaProjection is a different API and lifecycle, so do not equate every possible way of obtaining screen pixels with this callback.
No identity or image
The API cannot tell you which person pressed a button, which package initiated a capture, where the image was saved, or what the pixels contain. If your product requirement depends on any of those details, this callback is insufficient.
Secure windows change the behavior
If the activity window uses FLAG_SECURE, onScreenCaptured() is not invoked. That is expected: the window is protected from screenshots rather than reported after one.
Recommended Free Tools
Rank #3
- YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
- LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
- MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
- NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
- BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.
Detection, prevention, and active capture are different jobs
| Approach | Purpose | Minimum API | User consent | Pixels available? | Scope or limitation |
|---|---|---|---|---|---|
Activity.ScreenCaptureCallback |
Detect a supported screenshot of your visible activity | 34 | No separate runtime prompt; Android shows a notice for each signal | No | Per activity; ADB and instrumentation captures are not covered; no capturer identity |
FLAG_SECURE |
Prevent sensitive content from appearing in screenshots and other non-secure displays | Not stated in the cited API material | Not a MediaProjection consent flow | No | Because the window is protected, the detection callback is not invoked |
| MediaProjection | Actively capture or share a display or app window | 21 | Yes, before each projection session | Yes, through a virtual display and Surface |
Requires session lifecycle management; Android 14 adds app-window sharing |
When to use FLAG_SECURE
Use FLAG_SECURE when the requirement is “this content must not appear in screenshots.” It is a prevention control, not an event stream. Apply it to the relevant activity window and provide a user-facing setting if your policy permits users to turn protection on or off. Because a secure window does not trigger onScreenCaptured(), do not enable both features expecting a detection event for blocked captures.
When to use MediaProjection
Use the android.media.projection APIs when your own app needs screen pixels for recording, sharing, or processing. A session starts with MediaProjectionManager.createScreenCaptureIntent(); the user must approve every session. The approved projection renders the selected display or app window to a virtual display backed by a Surface. Android 14 adds app-window sharing.
Register MediaProjection.Callback.onStop() and release the virtual display and its surface when the session ends. Treat projection tokens as one-time access to screen contents (and, where applicable, audio), not as a replacement for screenshot-event detection. Managed-device administrators can use DevicePolicyManager.setScreenCaptureDisabled() for policy-based blocking.
Testing and production checklist
- Run the app on Android 14 or later and verify that the manifest contains
DETECT_SCREEN_CAPTURE. - Open the monitored activity so it is visible, then use a supported device screenshot action.
- Confirm that the handler records one event and that the Android notice is shown to the user.
- Navigate away from the activity and verify that the callback is no longer registered after
onStop(). - Test an API 33 or older device and confirm that the guarded code leaves the app functional without claiming detection support.
- Test a secure window separately; its screenshots should be blocked and should not produce a callback.
- Document that ADB and instrumentation captures are outside the callback’s documented coverage.
- If you need actual pixels, test a separate MediaProjection consent flow and release resources from
MediaProjection.Callback.onStop().
Troubleshooting
The code will not compile
Check that the project is compiling against an SDK that contains API 34’s Activity.ScreenCaptureCallback. Keep references behind an API-level guard so older devices do not execute them.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchRank #4
- PRIVACY DISPLAY: Automatically hide your screen from those beside you. The built-in privacy display can be preset¹ to turn on when receiving notifications, typing passwords, or using specific apps
- TYPE IT IN. TRANSFORM IT FAST: Enhance any shot in seconds on your smartphone by using Photo Assist² with Galaxy AI.³ Add objects, restore details, or apply new styles by simply typing or tapping
- NIGHTS, CAPTURED CLEARLY: From gigs to city lights, record and capture moments after dark with clarity using Nightography so your photos and videos stay crisp and clear on your Samsung Galaxy
- MAKE IT. EDIT IT. SHARE IT: Turn everyday moments into something personal with creative tools built right into your mobile phone, whether it’s a special contact photo, custom wallpaper, an invitation or more⁴
- HELP THAT KEEPS UP: Stay in the moment while Now Nudge with Galaxy AI helps you respond faster and stay organized with smart suggestions⁵ that appear exactly when you need them on your phone
The callback never fires on an older phone
This is expected below API 34. The standardized callback is an Android 14 feature; provide an explicit “not supported on this Android version” behavior rather than promising equivalent detection.
The callback fires only for some captures
It is not a universal screen-sniffing mechanism. ADB screenshot commands and instrumentation captures are documented exclusions, and the callback applies to a visible monitored activity. Verify that the activity is started and that registration occurs in onStart().
No callback occurs after enabling screenshot blocking
Check whether the window has FLAG_SECURE. Android does not invoke onScreenCaptured() for a secure activity because the screenshot is being prevented.
The team expects an image in the callback
Change the design. The callback is notification-only. Use a user-consented MediaProjection session when your app legitimately needs screen pixels.
Free tools Windows power users keep installed
One-click scans. No signup required.
Best Value
- Carrier: This phone is locked to Tracfone, which means this device can only be used on the Tracfone wireless network. Activating is easy, just 3 steps.
- ACTIVATION Promotion: Includes 1500 min, 1500 texts & 1500 MB Data + add more as you need it
- CAMERA SYSTEM: 50MP Quad Pixel camera. Capture sharper, more vibrant photos day or night with 4x the light sensitivity.
- PERFORMANCE: Blazing-fast Qualcomm performance. Get the speed you need for great entertainment with a Snapdragon 680 processor and 4GB of RAM.
- 64GB built-in storage. Get plenty of room for photos, movies, songs, and apps. Made for US
Users are surprised by a system notice
Explain in the UI or privacy documentation that screenshot detection is active and that Android shows a notice for each signal. Avoid implying that the app receives the image or the capturer’s identity.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or skip the browser setup
If what you actually need is an automated screenshot of a website—not detection inside an Android activity—ScreenshotNeo returns a clean image or PDF from one request. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; those steps can be disabled. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the page verdict and billing result in headers. Its MCP server lets Claude, Cursor, and other MCP clients call take_screenshot, get_page_info, and capture_pdf.
cURL:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for output formats and options. The free plan includes 1,000 shots each month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.
FAQ
Can I use the callback to audit screenshots taken while my activity is in the background?
No. The callback is tied to a monitored activity while it is visible. It is not a device-wide screenshot audit service.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Can a callback replace MediaProjection for screen sharing?
No. The callback reports an event without pixels. Screen sharing requires a separate, user-consented MediaProjection session.
Frequently Asked Questions
Can I use the callback to audit screenshots taken while my activity is in the background?
No. The callback is tied to a monitored activity while it is visible. It is not a device-wide screenshot audit service.
Can a callback replace MediaProjection for screen sharing?
No. The callback reports an event without pixels. Screen sharing requires a separate, user-consented MediaProjection session.
The Bottom Line
For Android 14 and newer, register Activity.ScreenCaptureCallback per visible activity with DETECT_SCREEN_CAPTURE. Use FLAG_SECURE to prevent captures and MediaProjection—with consent—to obtain screen pixels; none of these mechanisms reveals who took a screenshot through the detection callback.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

