Detection of screenshot taken?

2020-03-26 07:00发布

问题:

Is there any way i can detect in my service when user takes screenshot of his android device?

The basic idea is whenever user takes screenshot of his device a popup will be displayed asking user to upload image to facebook, twitter etc.

回答1:

This is untested, but you may want to try the FileObserver class.

Point it at the screenshots folder and wait for a CREATE event.

https://developer.android.com/reference/android/os/FileObserver.html