Skip to content

Instantly share code, notes, and snippets.

@kartikarora
Created April 15, 2023 22:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kartikarora/d9006e0e44aa1d30924a7f4e4624e170 to your computer and use it in GitHub Desktop.
Save kartikarora/d9006e0e44aa1d30924a7f4e4624e170 to your computer and use it in GitHub Desktop.
Android 14 Screenshot Callback on Activity
class ScreenCaptureActivity : AppCompatActivity(), Activity.ScreenCaptureCallback {
...
override fun onStart() {
super.onStart()
registerScreenCaptureCallback(mainExecutor, this)
}
override fun onStop() {
super.onStop()
unregisterScreenCaptureCallback(this)
}
override fun onScreenCaptured() {
// Do what you want to do with the detection
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment