补充Android13权限问题
This commit is contained in:
parent
8e19ddcc99
commit
357ece2ebe
@ -64,6 +64,7 @@
|
||||
<uses-permission android:name="android.permission.FLASHLIGHT" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission
|
||||
|
@ -4,6 +4,7 @@ import android.Manifest;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@ -164,15 +165,22 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
||||
|
||||
//intoIndex 1=调用相机,2=照片选取,3=视频选取
|
||||
public void jumpPic(int intoIndex) {
|
||||
String permission1=Manifest.permission.READ_EXTERNAL_STORAGE;
|
||||
String permission2= Manifest.permission.WRITE_EXTERNAL_STORAGE;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
permission1=Manifest.permission.READ_MEDIA_IMAGES;
|
||||
permission2=Manifest.permission.READ_MEDIA_VIDEO;
|
||||
}
|
||||
|
||||
//选择图片
|
||||
int isPermission1 = ContextCompat.checkSelfPermission(mContext, Manifest.permission.READ_EXTERNAL_STORAGE);
|
||||
int isPermission2 = ContextCompat.checkSelfPermission(mContext, Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
int isPermission1 = ContextCompat.checkSelfPermission(mContext, permission1);
|
||||
int isPermission2 = ContextCompat.checkSelfPermission(mContext, permission2);
|
||||
if (isPermission1 == PackageManager.PERMISSION_GRANTED && isPermission2 == PackageManager.PERMISSION_GRANTED) {
|
||||
startActivity(intoIndex);
|
||||
} else {
|
||||
//申请权限
|
||||
ActivityCompat.requestPermissions(mContext, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE);
|
||||
ActivityCompat.requestPermissions(mContext, new String[]{permission1,
|
||||
permission2}, PERMISSION_REQUEST_CODE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import android.Manifest;
|
||||
import android.app.ActionBar;
|
||||
import android.app.Dialog;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
@ -161,11 +162,20 @@ public class LiveMicUserDialogFragment extends AbsDialogFragment implements View
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_DEFAULT) {
|
||||
LiveAudienceActivity.mProcessResultUtil.requestPermissions(new String[]{
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
Manifest.permission.RECORD_AUDIO
|
||||
}, new Runnable() {
|
||||
String[] permissions;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
permissions=new String[]{
|
||||
Manifest.permission.READ_MEDIA_IMAGES,
|
||||
Manifest.permission.RECORD_AUDIO
|
||||
};
|
||||
}else{
|
||||
permissions=new String[]{
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
Manifest.permission.RECORD_AUDIO
|
||||
};
|
||||
}
|
||||
LiveAudienceActivity.mProcessResultUtil.requestPermissions(permissions, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
|
@ -3,6 +3,7 @@ package com.yunbao.live.dialog;
|
||||
import android.Manifest;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
@ -162,15 +163,21 @@ public class PDLIiveChatConversationFragment extends AbsDialogFragment implement
|
||||
|
||||
//intoIndex 1=调用相机,2=照片选取,3=视频选取
|
||||
public void jumpPic(int intoIndex) {
|
||||
String permission1=Manifest.permission.READ_EXTERNAL_STORAGE;
|
||||
String permission2= Manifest.permission.WRITE_EXTERNAL_STORAGE;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
permission1=Manifest.permission.READ_MEDIA_IMAGES;
|
||||
permission2=Manifest.permission.READ_MEDIA_IMAGES;
|
||||
}
|
||||
//选择图片
|
||||
int isPermission1 = ContextCompat.checkSelfPermission(mContext, Manifest.permission.READ_EXTERNAL_STORAGE);
|
||||
int isPermission2 = ContextCompat.checkSelfPermission(mContext, Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
int isPermission1 = ContextCompat.checkSelfPermission(mContext, permission1);
|
||||
int isPermission2 = ContextCompat.checkSelfPermission(mContext, permission2);
|
||||
if (isPermission1 == PackageManager.PERMISSION_GRANTED && isPermission2 == PackageManager.PERMISSION_GRANTED) {
|
||||
startActivity(intoIndex);
|
||||
} else {
|
||||
//申请权限
|
||||
ActivityCompat.requestPermissions(getActivity(), new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE);
|
||||
ActivityCompat.requestPermissions(getActivity(), new String[]{permission1,
|
||||
permission2}, PERMISSION_REQUEST_CODE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
@ -587,12 +588,22 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
|
||||
if (processResultUtil == null) {
|
||||
return;
|
||||
}
|
||||
processResultUtil.requestPermissions(new String[]{
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
Manifest.permission.CAMERA,
|
||||
Manifest.permission.RECORD_AUDIO
|
||||
}, new Runnable() {
|
||||
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
|
||||
};
|
||||
}
|
||||
processResultUtil.requestPermissions(permissions, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SocketLinkMicUtil.audienceApplyLinkMic(mSocketClient);
|
||||
|
@ -11,6 +11,7 @@ import android.content.pm.PackageManager;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.media.MediaMetadataRetriever;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Parcelable;
|
||||
import android.text.Editable;
|
||||
@ -682,14 +683,20 @@ public class SystemMessageViewHolder extends AbsViewHolder implements View.OnCli
|
||||
//intoIndex 1=调用相机,2=照片选取,3=视频选取
|
||||
public void choosePic(int intoIndex) {
|
||||
//选择图片
|
||||
int isPermission1 = ContextCompat.checkSelfPermission(mContext, Manifest.permission.READ_EXTERNAL_STORAGE);
|
||||
int isPermission2 = ContextCompat.checkSelfPermission(mContext, Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
String permission1=Manifest.permission.READ_EXTERNAL_STORAGE;
|
||||
String permission2= Manifest.permission.WRITE_EXTERNAL_STORAGE;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
permission1=Manifest.permission.READ_MEDIA_IMAGES;
|
||||
permission2=Manifest.permission.READ_MEDIA_VIDEO;
|
||||
}
|
||||
int isPermission1 = ContextCompat.checkSelfPermission(mContext, permission1);
|
||||
int isPermission2 = ContextCompat.checkSelfPermission(mContext, permission2);
|
||||
if (isPermission1 == PackageManager.PERMISSION_GRANTED && isPermission2 == PackageManager.PERMISSION_GRANTED) {
|
||||
startActivity(intoIndex);
|
||||
} else {
|
||||
//申请权限
|
||||
ActivityCompat.requestPermissions(nowActivity, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE);
|
||||
ActivityCompat.requestPermissions(nowActivity, new String[]{permission1,
|
||||
permission2}, PERMISSION_REQUEST_CODE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -309,10 +309,18 @@ public class ThreeDistributActivity extends AbsActivity implements View.OnClickL
|
||||
* 生成分享图片
|
||||
*/
|
||||
private void saveBitmapFile() {
|
||||
mProcessResultUtil.requestPermissions(new String[]{
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
}, new Runnable() {
|
||||
String[] permissions;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
permissions=new String[]{
|
||||
Manifest.permission.READ_MEDIA_IMAGES
|
||||
};
|
||||
}else{
|
||||
permissions=new String[]{
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
};
|
||||
}
|
||||
mProcessResultUtil.requestPermissions(permissions, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mContainer == null) {
|
||||
|
@ -6,6 +6,7 @@ import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.media.MediaMetadataRetriever;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.view.WindowManager;
|
||||
|
||||
@ -143,10 +144,18 @@ public abstract class AbsVideoPlayActivity extends AbsVideoCommentActivity {
|
||||
if (mProcessResultUtil == null || videoBean == null || TextUtils.isEmpty(videoBean.getHref())) {
|
||||
return;
|
||||
}
|
||||
mProcessResultUtil.requestPermissions(new String[]{
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
}, new Runnable() {
|
||||
String[] permissions;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
permissions=new String[]{
|
||||
Manifest.permission.READ_MEDIA_IMAGES
|
||||
};
|
||||
}else{
|
||||
permissions=new String[]{
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE
|
||||
};
|
||||
}
|
||||
mProcessResultUtil.requestPermissions(permissions, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mDownloadVideoDialog = DialogUitl.loadingDialog(mContext);
|
||||
|
Loading…
Reference in New Issue
Block a user