Has anyone managed to implement the Android 14 screenshot detection?
I would like to hide my app's floating UI when a screenshot is taken.
https://developer.android.com/about/versions/14/features/screenshot-detection#java
This Java part doesn't compile and I'm not sure how to get B4A to register this kind of callback:
Error shown:
I would like to hide my app's floating UI when a screenshot is taken.
https://developer.android.com/about/versions/14/features/screenshot-detection#java
This Java part doesn't compile and I'm not sure how to get B4A to register this kind of callback:
Java:
final Activity.ScreenCaptureCallback screenCaptureCallback =
new Activity.ScreenCaptureCallback() {
@Override
public void onScreenCaptured() {
// Add logic to take action in your app.
}
};
Error shown:
B4X:
B4A Version: 12.80
Parsing code. (0.00s)
Java Version: 11
Building folders structure. (0.01s)
Compiling code. (0.01s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
(AndroidX SDK)
Compiling resources (0.12s)
Linking resources (0.13s)
Compiling generated Java code. Error
B4A line: 19
End Sub
src\b4a\example\main.java:405: error: cannot find symbol
final Activity.ScreenCaptureCallback screenCaptureCallback =
^
symbol: class ScreenCaptureCallback
location: class Activity
Last edited: