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