app的build.gradle文件添加一行:
dependencies {
//获取权限,自动弹出确认框
implementation 'com.mylhyl:acp:1.2.0'
}
//获取权限
Acp.getInstance(this).request(new AcpOptions.Builder().setPermissions
(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_PHONE_STATE,
Manifest.permission.RECORD_AUDIO
).build(),
new AcpListener() {
@Override
public void onGranted() {
//到这儿表示,全部的权限都能支持了
println("init base log activity succeed");
}
@Override
public void onDenied(List<String> permissions) {
println("Error:Please accept the permission require");
}
});