diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index c6e47c1a3..9e513cf6e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -62,6 +62,8 @@ + + = Build.VERSION_CODES.TIRAMISU) { + mCameraPermissions = new String[]{ + Manifest.permission.READ_MEDIA_IMAGES, + Manifest.permission.CAMERA + }; + mAlumbPermissions = new String[]{ + Manifest.permission.READ_MEDIA_IMAGES, + }; + } mCameraPermissionCallback = new Runnable() { @Override public void run() { diff --git a/main/src/main/java/com/yunbao/main/dialog/MainStartDialogFragment.java b/main/src/main/java/com/yunbao/main/dialog/MainStartDialogFragment.java index 74a2bbf45..5c36c21d7 100644 --- a/main/src/main/java/com/yunbao/main/dialog/MainStartDialogFragment.java +++ b/main/src/main/java/com/yunbao/main/dialog/MainStartDialogFragment.java @@ -6,6 +6,7 @@ import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.app.Dialog; import android.content.Intent; +import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.view.Gravity; @@ -160,12 +161,22 @@ public class MainStartDialogFragment extends AbsDialogFragment implements View.O public void onLiveClick() { boolean isAnchor = IMLoginManager.get(mContext).getUserInfo().anchorUserType(); if (isAnchor) { - mProcessResultUtil.requestPermissions(new String[]{ - Manifest.permission.READ_EXTERNAL_STORAGE, - Manifest.permission.WRITE_EXTERNAL_STORAGE, - Manifest.permission.CAMERA, - Manifest.permission.RECORD_AUDIO - }, mStartLiveRunnable); + String[] permissions; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + permissions=new String[]{ + Manifest.permission.READ_MEDIA_IMAGES, + Manifest.permission.CAMERA, + Manifest.permission.RECORD_AUDIO + }; + }else{ + permissions=new String[]{ + Manifest.permission.READ_EXTERNAL_STORAGE, + Manifest.permission.WRITE_EXTERNAL_STORAGE, + Manifest.permission.CAMERA, + Manifest.permission.RECORD_AUDIO + }; + } + mProcessResultUtil.requestPermissions(permissions, mStartLiveRunnable); } else { ToastUtil.show(getString(R.string.only_open_anchor)); } @@ -176,12 +187,22 @@ public class MainStartDialogFragment extends AbsDialogFragment implements View.O public void onVideoClick() { boolean isAnchor = IMLoginManager.get(mContext).getUserInfo().anchorUserType(); if (isAnchor) { - mProcessResultUtil.requestPermissions(new String[]{ - Manifest.permission.READ_EXTERNAL_STORAGE, - Manifest.permission.WRITE_EXTERNAL_STORAGE, - Manifest.permission.CAMERA, - Manifest.permission.RECORD_AUDIO - }, mStartVideoRunnable); + String[] permissions; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + permissions=new String[]{ + Manifest.permission.READ_MEDIA_IMAGES, + Manifest.permission.CAMERA, + Manifest.permission.RECORD_AUDIO + }; + }else{ + permissions=new String[]{ + Manifest.permission.READ_EXTERNAL_STORAGE, + Manifest.permission.WRITE_EXTERNAL_STORAGE, + Manifest.permission.CAMERA, + Manifest.permission.RECORD_AUDIO + }; + } + mProcessResultUtil.requestPermissions(permissions, mStartVideoRunnable); } else { ToastUtil.show(getString(R.string.only_open_anchor)); }