Język

MediaProjectionConfig.Builder.SetOwnAppContentProvided(Boolean) Method

Definition

Indicates to the system that the requesting application is offering its own content to be shared as MediaProjectionConfig.PROJECTION_SOURCE_APP_CONTENT.

[Android.Runtime.Register("setOwnAppContentProvided", "(Z)Landroid/media/projection/MediaProjectionConfig$Builder;", "", ApiSince=37)]
public Android.Media.Projection.MediaProjectionConfig.Builder SetOwnAppContentProvided(bool isEnabled);
[<Android.Runtime.Register("setOwnAppContentProvided", "(Z)Landroid/media/projection/MediaProjectionConfig$Builder;", "", ApiSince=37)>]
member this.SetOwnAppContentProvided : bool -> Android.Media.Projection.MediaProjectionConfig.Builder

Parameters

isEnabled
Boolean

true to offer the requesting application's own content; otherwise, false.

Returns

This builder, so additional settings can be made.

Attributes

Remarks

Indicates to the system that the requesting application is offering its own content to be shared as MediaProjectionConfig.PROJECTION_SOURCE_APP_CONTENT.

When setOwnAppContentProvided(boolean) is set to true, the requesting app's content will override any content from other apps that might have been displayed by the system.

To offer its own content, the application must declare a service that inherits from AppContentProjectionService and add an intent filter for AppContentProjectionService.SERVICE_INTERFACE. The service must be exported and protected by android.permission.MANAGE_MEDIA_PROJECTION.

<application>
 ...
<service
       android:exported="true"
       android:name="com.example.AppContentSharingService"
       android:permission="android.permission.MANAGE_MEDIA_PROJECTION">
<intent-filter>
<action android:name="android.media.projection.AppContentProjectionService"/>
</intent-filter>
</service>
</application>

If supported by the device, the content will be displayed to the user in the media projection picker and AppContentProjectionService.onContentRequest(AppContentRequest) will be called, giving this application a chance to provide or update the content to be shared.

If the user selects an item from this list, AppContentProjectionService.onLoopbackProjectionStarted(AppContentProjectionSession,int) will be called and the projection session will be considered as started.

If the shared content becomes unavailable, this application will be responsible for calling AppContentProjectionSession.notifySessionStop(). If the session is stopped outside of this application AppContentProjectionService.onSessionStopped(AppContentProjectionSession) will be called.

Android reference for android.media.projection.MediaProjectionConfig.Builder.setOwnAppContentProvided.

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