Share via


IWindowManager.AddScreenRecordingCallback(IExecutor, IConsumer) Method

Definition

Adds a screen recording callback.

[Android.Runtime.Register("addScreenRecordingCallback", "(Ljava/util/concurrent/Executor;Ljava/util/function/Consumer;)I", "GetAddScreenRecordingCallback_Ljava_util_concurrent_Executor_Ljava_util_function_Consumer_Handler:Android.Views.IWindowManager, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=35)]
[Android.Runtime.RequiresPermission("android.permission.DETECT_SCREEN_RECORDING")]
public virtual int AddScreenRecordingCallback (Java.Util.Concurrent.IExecutor executor, Java.Util.Functions.IConsumer callback);
[<Android.Runtime.Register("addScreenRecordingCallback", "(Ljava/util/concurrent/Executor;Ljava/util/function/Consumer;)I", "GetAddScreenRecordingCallback_Ljava_util_concurrent_Executor_Ljava_util_function_Consumer_Handler:Android.Views.IWindowManager, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=35)>]
[<Android.Runtime.RequiresPermission("android.permission.DETECT_SCREEN_RECORDING")>]
abstract member AddScreenRecordingCallback : Java.Util.Concurrent.IExecutor * Java.Util.Functions.IConsumer -> int
override this.AddScreenRecordingCallback : Java.Util.Concurrent.IExecutor * Java.Util.Functions.IConsumer -> int

Parameters

executor
IExecutor

The executor on which callback method will be invoked.

callback
IConsumer

The callback that will be invoked when screen recording visibility changes.

Returns

the current screen recording state.

Attributes

Remarks

Adds a screen recording callback. The callback will be invoked whenever the app becomes visible in screen recording or was visible in screen recording and becomes invisible in screen recording.

An app is considered visible in screen recording if any activities owned by the registering process's UID are being recorded.

Example:

windowManager.addScreenRecordingCallback(state -> {
                // handle change in screen recording state
            });

Java documentation for android.view.WindowManager.addScreenRecordingCallback(java.util.concurrent.Executor, java.util.function.Consumer<java.lang.Integer>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to