Most visited

Recently visited

Added in API level 21

MediaProjectionManager

public final class MediaProjectionManager
extends Object

java.lang.Object
   ↳ android.media.projection.MediaProjectionManager


Manages the retrieval of certain types of MediaProjection tokens.

Get an instance of this class by calling Context.getSystemService() with the argument MEDIA_PROJECTION_SERVICE.

Summary

Public methods

Intent createScreenCaptureIntent()

Returns an Intent that must passed to startActivityForResult() in order to start screen capture.

MediaProjection getMediaProjection(int resultCode, Intent resultData)

Retrieve the MediaProjection obtained from a succesful screen capture request.

Inherited methods

From class java.lang.Object

Public methods

createScreenCaptureIntent

Added in API level 21
Intent createScreenCaptureIntent ()

Returns an Intent that must passed to startActivityForResult() in order to start screen capture. The activity will prompt the user whether to allow screen capture. The result of this activity should be passed to getMediaProjection.

Returns
Intent

getMediaProjection

Added in API level 21
MediaProjection getMediaProjection (int resultCode, 
                Intent resultData)

Retrieve the MediaProjection obtained from a succesful screen capture request. Will be null if the result from the startActivityForResult() is anything other than RESULT_OK.

Parameters
resultCode int: The result code from onActivityResult(int, int, android.content.Intent)
resultData Intent: The resulting data from onActivityResult(int, int, android.content.Intent)
Returns
MediaProjection

Hooray!