ScreenshotDetection icon indicating copy to clipboard operation
ScreenshotDetection copied to clipboard

Can't detect in Chinese device like VIVO

Open shofiulla-iota opened this issue 4 years ago • 3 comments

shofiulla-iota avatar Aug 18 '20 09:08 shofiulla-iota

I don't have VIVO device to test this problem but I think it might be file path doesn't include "screenshot"

If you still have this problem. You can fork my repo and change the condition in ScreenshotDetectionDelegate.isScreenshotPath(path: String?)

But I still keep this open issue until I get some VIVO device.

akexorcist avatar Dec 26 '20 18:12 akexorcist

1

You might like to try retrieving the name of the final directory in DIRECTORY_SCREENSHOTS

Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_SCREENSHOTS).name.toLowerCase(Locale.getDefault())

but I think that's only available in Android Q?

2

Perhaps if the detection of the screenshot directory path could be an optional parameter to the delegate class?

3

I can only see one place that MediaStore.Images.Media.EXTERNAL_CONTENT_URI is used in the android source code, and that is to signal that the user is taking a screenshot. Have you encountered anywhere that this URI is used that does not involve taking a screenshot? You might get away with not having a "screenshot" substring test at all.

pcholt avatar Apr 15 '21 07:04 pcholt

@pcholt 1 and 2 I put that code in library for additional checking.

3 That's URI for general image content in Android. When we observe the changes in EXTERNAL_CONTENT_URI. It could be any image content. So we don't know which URI is coming from taking a screenshot.

akexorcist avatar Nov 10 '21 20:11 akexorcist