Android实现录屏和截屏功能
1. MediaProjectionManager介绍
用于获取screen capture的主要类,在Android 5.0(Api Level 21)时添加。
核心方法:
(1)创建:public Intent createScreenCaptureIntent ()
Returns an Intent that must be passed to startActivityForResult() in order to start screen capture. The activity will prompt the userwhether to allow screen capture. The result of this activity should be passed to getMediaProjection.
(使用时会弹出授权弹窗,只有用户授权后才能使用)
(2)获取:public 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.
2.所需权限
<uses-permission and