ServiceInfo.ForegroundServiceTypeMediaProjection Field

Definition

Caution

This constant will be removed in the future version. Use Android.Content.PM.ForegroundService enum directly instead of this field.

Constant corresponding to mediaProjection in the android.R.attr#foregroundServiceType foregroundServiceType attribute.

[Android.Runtime.Register("FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION", ApiSince=29)]
[Android.Runtime.RequiresPermission("android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION")]
[System.Obsolete("This constant will be removed in the future version. Use Android.Content.PM.ForegroundService enum directly instead of this field.", true)]
public const Android.Content.PM.ForegroundService ForegroundServiceTypeMediaProjection = 32;
[<Android.Runtime.Register("FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION", ApiSince=29)>]
[<Android.Runtime.RequiresPermission("android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION")>]
[<System.Obsolete("This constant will be removed in the future version. Use Android.Content.PM.ForegroundService enum directly instead of this field.", true)>]
val mutable ForegroundServiceTypeMediaProjection : Android.Content.PM.ForegroundService

Field Value

Value = 32

Implements

Attributes

Remarks

Constant corresponding to mediaProjection in the android.R.attr#foregroundServiceType foregroundServiceType attribute.

To capture through android.media.projection.MediaProjection, an app must start a foreground service with the type corresponding to this constant. This type should only be used for android.media.projection.MediaProjection. Capturing screen contents via android.media.projection.MediaProjection#createVirtualDisplay(String, int, int, int, int, android.view.Surface, android.hardware.display.VirtualDisplay.Callback, android.os.Handler) createVirtualDisplay conveniently allows recording, presenting screen contents into a meeting, taking screenshots, or several other scenarios.

Starting foreground service with this type from apps targeting API level android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE and later, will require permission android.Manifest.permission#FOREGROUND_SERVICE_MEDIA_PROJECTION, and the user must have allowed the screen capture request from this app.

Java documentation for android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION.

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