Share via


MediaProjection.Callback.OnCapturedContentVisibilityChanged(Boolean) Method

Definition

Invoked immediately after capture begins or when the visibility of the captured region changes, providing the current visibility of the captured region.

[Android.Runtime.Register("onCapturedContentVisibilityChanged", "(Z)V", "GetOnCapturedContentVisibilityChanged_ZHandler", ApiSince=34)]
public virtual void OnCapturedContentVisibilityChanged (bool isVisible);
[<Android.Runtime.Register("onCapturedContentVisibilityChanged", "(Z)V", "GetOnCapturedContentVisibilityChanged_ZHandler", ApiSince=34)>]
abstract member OnCapturedContentVisibilityChanged : bool -> unit
override this.OnCapturedContentVisibilityChanged : bool -> unit

Parameters

isVisible
Boolean
Attributes

Remarks

Invoked immediately after capture begins or when the visibility of the captured region changes, providing the current visibility of the captured region.

Applications can take advantage of this callback by showing or hiding the captured content from the output Surface, based on if the captured region is currently visible to the user.

For example, if the user elected to capture a single app (from the activity shown from MediaProjectionManager#createScreenCaptureIntent()), the following scenarios trigger the callback: <ul> <li> The captured region is visible (isVisible with value true), because the captured app is at least partially visible. This may happen if the user moves the covering app to show at least some portion of the captured app (e.g. the user has multiple apps visible in a multi-window mode such as split screen). </li> <li> The captured region is invisible (isVisible with value false) if it is entirely hidden. This may happen if another app entirely covers the captured app, or the user navigates away from the captured app. </li> </ul>

Java documentation for android.media.projection.MediaProjection.Callback.onCapturedContentVisibilityChanged(boolean).

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