Created
April 15, 2023 22:13
-
-
Save kartikarora/d9006e0e44aa1d30924a7f4e4624e170 to your computer and use it in GitHub Desktop.
Android 14 Screenshot Callback on Activity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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