Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

打包时加入授权代码 #237

Open
bigsea668 opened this issue Apr 9, 2024 · 0 comments
Open

打包时加入授权代码 #237

bigsea668 opened this issue Apr 9, 2024 · 0 comments

Comments

@bigsea668
Copy link

作者大大能否在打包时对打包的程序代码进行增加授权功能?autojs您已经添加了“投影媒体权限”,但是打包后不能直接授权这个权限,只能每次截图时点击确认授权,能否也把这些改为可自定义添加:
val mediaProjectionManager = getSystemService(Context.MEDIA_PROJECTION_SERVICE) as MediaProjectionManager
val intent = mediaProjectionManager.createScreenCaptureIntent()
startActivityForResult(intent, REQUEST_CODE_CAPTURE_PERM)

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == REQUEST_CODE_CAPTURE_PERM) {
if (resultCode == RESULT_OK) {
// 用户授予了权限,可以继续处理MediaProjection
val mediaProjection = mediaProjectionManager.getMediaProjection(resultCode, data)
// 使用mediaProjection进行后续操作
} else {
// 用户拒绝了权限,处理拒绝情况
}
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant