In the recent development, to realize the screen recording function, check the relevant information and find that you can call the api of MediaProjectionManager to realize the screen recording function:
import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.media.projection.MediaProjectionManager;
import android.os.Build;
import android.os.Bundle;