Most visited

Recently visited

Added in API level 21

MediaProjectionManager

public final class MediaProjectionManager
extends Object

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


管理某些类型的 MediaProjection令牌的检索。

通过使用参数 MEDIA_PROJECTION_SERVICE调用 Context.getSystemService()来获得 MEDIA_PROJECTION_SERVICE

Summary

Public methods

Intent createScreenCaptureIntent()

返回 必须传递给startActivityForResult()以开始屏幕捕获的Intent。

MediaProjection getMediaProjection(int resultCode, Intent resultData)

检索从成功的屏幕捕获请求获取的MediaProjection。

Inherited methods

From class java.lang.Object

Public methods

createScreenCaptureIntent

Added in API level 21
Intent createScreenCaptureIntent ()

返回必须传递给startActivityForResult()以开始屏幕捕获的Intent。 该活动将提示用户是否允许屏幕截图。 此活动的结果应传递给getMediaProjection。

Returns
Intent

getMediaProjection

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

检索从成功的屏幕捕获请求获取的MediaProjection。 如果startActivityForResult()的结果不是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!