{
	"id": "430dd6b7-2a88-405f-b780-246782ab1b96",
	"created_at": "2026-04-06T00:19:30.664781Z",
	"updated_at": "2026-04-10T03:20:02.174074Z",
	"deleted_at": null,
	"sha1_hash": "ef8e5387e5c4a68a702f8771687387ad423f8d5f",
	"title": "MediaProjectionManager  |  API reference  |  Android Developers",
	"llm_title": "",
	"authors": "",
	"file_creation_date": "0001-01-01T00:00:00Z",
	"file_modification_date": "0001-01-01T00:00:00Z",
	"file_size": 129679,
	"plain_text": "MediaProjectionManager  |  API reference  |  Android Developers\r\nArchived: 2026-04-05 23:33:19 UTC\r\npublic final class MediaProjectionManager\r\nextends Object\r\nManages the retrieval of certain types of MediaProjection tokens.\r\nAn example flow of starting a media projection will be:\r\n1. Declare a foreground service with the type mediaProjection in the AndroidManifest.xml .\r\n2. Create an intent by calling MediaProjectionManager.createScreenCaptureIntent() and pass this intent to\r\nActivity.startActivityForResult(Intent,int) .\r\n3. On getting Activity.onActivityResult(int,int,Intent) , start the foreground service with the type\r\nServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION .\r\n4. Retrieve the media projection token by calling MediaProjectionManager.getMediaProjection(int,Intent) with the\r\nresult code and intent from the Activity.onActivityResult(int,int,Intent) above.\r\n5. Register a MediaProjection.Callback by calling\r\nMediaProjection.registerCallback(MediaProjection.Callback,Handler) . This is required to receive notifications\r\nabout when the MediaProjection or captured content changes state. When receiving an `onStop()` callback the\r\nMediaProjection session has been finished and the client must clean up any resources it is holding, e.g. the\r\nVirtualDisplay and Surface . The MediaProjection may further no longer create any new VirtualDisplay s via\r\nMediaProjection.createVirtualDisplay(String,int,int,int,int,Surface,VirtualDisplay.Callback,Handler) .\r\nNote that the `onStop()` callback can be a result of the system stopping MediaProjection due to various reasons. This\r\nincludes the user stopping the MediaProjection via UI affordances in system-level UI, the screen being locked, or\r\nanother MediaProjection session starting.\r\n6. Start the screen capture session for media projection by calling\r\nMediaProjection.createVirtualDisplay(String,int,int,int,int,Surface,android.hardware.display.VirtualDisplay.Callback,\r\nSummary\r\nPublic methods\r\nIntent\r\ncreateScreenCaptureIntent()\r\nReturns an Intent that must be passed to Activity.startActivityForResult(Intent,int) (or\r\nsimilar) in order to start screen capture.\r\nIntent\r\ncreateScreenCaptureIntent(MediaProjectionConfig config)\r\nReturns an Intent that must be passed to Activity.startActivityForResult(Intent,int) (or\r\nsimilar) in order to start screen capture.\r\nMedia\r\nProjection\r\ngetMediaProjection(int resultCode, Intent resultData)\r\nRetrieves the MediaProjection obtained from a successful screen capture request.\r\nInherited methods\r\nhttps://developer.android.com/reference/android/media/projection/MediaProjectionManager\r\nPage 1 of 4\n\nFrom class java.lang.Object\r\nObject\r\nclone()\r\nCreates and returns a copy of this object.\r\nboolean\r\nequals(Object obj)\r\nIndicates whether some other object is \"equal to\" this one.\r\nvoid\r\nfinalize()\r\nCalled by the garbage collector on an object when garbage collection determines that there are no\r\nmore references to the object.\r\nfinal\r\nClass\u003c?\u003e\r\ngetClass()\r\nReturns the runtime class of this Object .\r\nint\r\nhashCode()\r\nReturns a hash code value for the object.\r\nfinal void\r\nnotify()\r\nWakes up a single thread that is waiting on this object's monitor.\r\nfinal void\r\nnotifyAll()\r\nWakes up all threads that are waiting on this object's monitor.\r\nString\r\ntoString()\r\nReturns a string representation of the object.\r\nfinal void\r\nwait(long timeoutMillis, int nanos)\r\nCauses the current thread to wait until it is awakened, typically by being notified or interrupted,\r\nor until a certain amount of real time has elapsed.\r\nfinal void\r\nwait(long timeoutMillis)\r\nCauses the current thread to wait until it is awakened, typically by being notified or interrupted,\r\nor until a certain amount of real time has elapsed.\r\nfinal void\r\nwait()\r\nCauses the current thread to wait until it is awakened, typically by being notified or interrupted.\r\nPublic methods\r\ncreateScreenCaptureIntent\r\npublic Intent createScreenCaptureIntent ()\r\nhttps://developer.android.com/reference/android/media/projection/MediaProjectionManager\r\nPage 2 of 4\n\nReturns an Intent that must be passed to Activity.startActivityForResult(Intent,int) (or similar) in order to start\r\nscreen capture. The activity will prompt the user whether to allow screen capture. The result of this activity (received by\r\noverriding onActivityResult(int, int, Intent) ) should be passed to getMediaProjection(int,Intent) .\r\nIdentical to calling createScreenCaptureIntent(MediaProjectionConfig) with a\r\nMediaProjectionConfig.createConfigForUserChoice() .\r\nShould be used instead of createScreenCaptureIntent(MediaProjectionConfig) when the calling app does not want to\r\ncustomize the activity shown to the user.\r\nReturns\r\nIntent This value cannot be null .\r\ncreateScreenCaptureIntent\r\npublic Intent createScreenCaptureIntent (MediaProjectionConfig config)\r\nReturns an Intent that must be passed to Activity.startActivityForResult(Intent,int) (or similar) in order to start\r\nscreen capture. Customizes the activity and resulting MediaProjection session based up the provided config . The\r\nactivity will prompt the user whether to allow screen capture. The result of this activity (received by overriding\r\nonActivityResult(int, int, Intent) ) should be passed to getMediaProjection(int,Intent) .\r\nIf MediaProjectionConfig was created from:\r\nMediaProjectionConfig.createConfigForDefaultDisplay() , then creates an Intent for capturing the default\r\ndisplay. The activity limits the user's choice to just the display specified.\r\nMediaProjectionConfig.createConfigForUserChoice() , then creates an Intent for deferring which region to\r\ncapture to the user. This gives the user the same behaviour as calling createScreenCaptureIntent() . The activity\r\ngives the user the choice between Display.DEFAULT_DISPLAY , or a different region.\r\nShould be used instead of createScreenCaptureIntent() when the calling app wants to customize the activity shown to\r\nthe user.\r\nParameters\r\nconfig\r\nMediaProjectionConfig : Customization for the MediaProjection that this Intent requests the user's\r\nconsent for.\r\nThis value cannot be null .\r\nReturns\r\nIntent\r\nAn Intent requesting the user's consent, specialized based upon the given configuration.\r\nThis value cannot be null .\r\nThrows\r\nIllegalArgumentException\r\nif MediaProjectionConfig.isOwnAppContentProvided() is true but no\r\nAppContentProjectionService is declared.\r\ngetMediaProjection\r\npublic MediaProjection getMediaProjection (int resultCode,\r\n Intent resultData)\r\nRetrieves the MediaProjection obtained from a successful screen capture request. The result code and data from the\r\nrequest are provided by overriding onActivityResult(int, int, Intent) , which is called after starting an activity using\r\nhttps://developer.android.com/reference/android/media/projection/MediaProjectionManager\r\nPage 3 of 4\n\ncreateScreenCaptureIntent() .\r\nStarting from Android R , if your application requests the SYSTEM_ALERT_WINDOW permission, and the user has not\r\nexplicitly denied it, the permission will be automatically granted until the projection is stopped. The permission allows your\r\napp to display user controls on top of the screen being captured.\r\nAn app targeting SDK version Q or later must invoke getMediaProjection and maintain the capture session\r\n( MediaProjection#createVirtualDisplay ) while running a foreground service. The app must set the\r\nforegroundServiceType attribute to FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION in the \u003cservice\u003e element of the app's\r\nmanifest file.\r\nFor an app targeting SDK version U or later, the user must have granted the app with the permission to start a projection,\r\nbefore the app starts a foreground service with the type ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION .\r\nAdditionally, the app must have started the foreground service with that type before calling this API here, or else it'll receive\r\na SecurityException from this API call, unless it's a privileged app. Apps can request the permission via the\r\ncreateScreenCaptureIntent() and Activity.startActivityForResult(Intent,int) (or similar APIs).\r\nParameters\r\nresultCode int : The result code from onActivityResult(int, int, Intent) .\r\nresultData\r\nIntent : The result data from onActivityResult(int, int, Intent) .\r\nThis value cannot be null .\r\nReturns\r\nMediaProjection\r\nThe media projection obtained from a successful screen capture request, or null if the result of the\r\nscreen capture request is not RESULT_OK .\r\nThrows\r\nIllegalStateException\r\nOn pre- Q devices if a previously obtained MediaProjection from the same\r\nresultData has not yet been stopped.\r\nSecurityException\r\nOn Q + devices if not invoked from a foreground service with type\r\nFOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION , unless caller is a privileged app.\r\nSource: https://developer.android.com/reference/android/media/projection/MediaProjectionManager\r\nhttps://developer.android.com/reference/android/media/projection/MediaProjectionManager\r\nPage 4 of 4",
	"extraction_quality": 1,
	"language": "EN",
	"sources": [
		"MITRE"
	],
	"references": [
		"https://developer.android.com/reference/android/media/projection/MediaProjectionManager"
	],
	"report_names": [
		"MediaProjectionManager"
	],
	"threat_actors": [],
	"ts_created_at": 1775434770,
	"ts_updated_at": 1775791202,
	"ts_creation_date": 0,
	"ts_modification_date": 0,
	"files": {
		"pdf": "https://archive.orkl.eu/ef8e5387e5c4a68a702f8771687387ad423f8d5f.pdf",
		"text": "https://archive.orkl.eu/ef8e5387e5c4a68a702f8771687387ad423f8d5f.txt",
		"img": "https://archive.orkl.eu/ef8e5387e5c4a68a702f8771687387ad423f8d5f.jpg"
	}
}