public final class MediaProjectionManager extends Object
MediaProjection
tokens.
Get an instance of this class by calling Context.getSystemService()
with the argument Context.MEDIA_PROJECTION_SERVICE
.
Modifier and Type | Class and Description |
---|---|
static class |
MediaProjectionManager.Callback |
Modifier and Type | Field and Description |
---|---|
static String |
EXTRA_APP_TOKEN |
static String |
EXTRA_MEDIA_PROJECTION |
static int |
TYPE_MIRRORING |
static int |
TYPE_PRESENTATION |
static int |
TYPE_SCREEN_CAPTURE |
Constructor and Description |
---|
MediaProjectionManager(Context context) |
Modifier and Type | Method and Description |
---|---|
void |
addCallback(MediaProjectionManager.Callback callback,
Handler handler)
Add a callback to monitor all of the
MediaProjection s activity. |
Intent |
createScreenCaptureIntent()
Returns an Intent that must passed to startActivityForResult()
in order to start screen capture.
|
MediaProjectionInfo |
getActiveProjectionInfo()
Get the
MediaProjectionInfo for the active MediaProjection . |
MediaProjection |
getMediaProjection(int resultCode,
Intent resultData)
Retrieve the MediaProjection obtained from a succesful screen
capture request.
|
void |
removeCallback(MediaProjectionManager.Callback callback)
Remove a MediaProjection monitoring callback.
|
void |
stopActiveProjection()
Stop the current projection if there is one.
|
public static final String EXTRA_APP_TOKEN
public static final String EXTRA_MEDIA_PROJECTION
public static final int TYPE_SCREEN_CAPTURE
public static final int TYPE_MIRRORING
public static final int TYPE_PRESENTATION
public MediaProjectionManager(Context context)
public Intent createScreenCaptureIntent()
public MediaProjection getMediaProjection(int resultCode, Intent resultData)
resultCode
- The result code from Activity.onActivityResult(int,
int, android.content.Intent)
resultData
- The resulting data from Activity.onActivityResult(int,
int, android.content.Intent)
public MediaProjectionInfo getActiveProjectionInfo()
MediaProjectionInfo
for the active MediaProjection
.public void stopActiveProjection()
public void addCallback(MediaProjectionManager.Callback callback, Handler handler)
MediaProjection
s activity.
Not for use by regular applications, must have the MANAGE_MEDIA_PROJECTION permission.public void removeCallback(MediaProjectionManager.Callback callback)