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

2020 after covid update #2

Merged
merged 11 commits into from
Sep 28, 2020
Prev Previous commit
Next Next commit
Add write storage permission
obarong committed Apr 16, 2020
commit d6919266e0259f84e3f0909ecd10f5db38ac2107
3 changes: 2 additions & 1 deletion app/src/main/java/net/ossrs/yasea/demo/MainActivity.java
Original file line number Diff line number Diff line change
@@ -73,10 +73,11 @@ private void requestPermission() {
//1. 检查是否已经有该权限
if (Build.VERSION.SDK_INT >= 23 && (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA)
!= PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO)
!= PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED)) {
//2. 权限没有开启,请求权限
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO}, RC_CAMERA);
new String[]{Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO, Manifest.permission.WRITE_EXTERNAL_STORAGE}, RC_CAMERA);
}else{
//权限已经开启,做相应事情
isPermissionGranted = true;