Open gaoluhan opened 1 year ago
您好,钟裕达已经收到您的来信并会尽快查收,谢谢!
@Glorylan 如果你的问题是,targetSdk = 33,会导致打开相册失败,提示没有符合条件的图片。你可以自己在应用里加上:
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
然后再打开调用EasyPhoto的API之前,找一个合适的点在request一下这个permission就可以了。
1.新增权限:
`
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />`
2.修改EasyPhotosActivity::getNeedPermissions 方法
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { return new String[]{ Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.READ_MEDIA_AUDIO, Manifest.permission.READ_MEDIA_VIDEO }; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { return new String[]{ Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE }; } return new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE};
3.修改AlbumModel::query
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { if (PermissionChecker.checkSelfPermission(context, Manifest.permission.READ_MEDIA_IMAGES) != PermissionChecker.PERMISSION_GRANTED) { if (null != callBack) callBack.onAlbumWorkedCallBack(); return; } } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { if (PermissionChecker.checkSelfPermission(context, Manifest.permission.READ_EXTERNAL_STORAGE) != PermissionChecker.PERMISSION_GRANTED) { if (null != callBack) callBack.onAlbumWorkedCallBack(); return; } }
完美解决
1.新增权限:
<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" />
2.修改EasyPhotosActivity::getNeedPermissions 方法if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { return new String[]{ Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.READ_MEDIA_AUDIO, Manifest.permission.READ_MEDIA_VIDEO }; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { return new String[]{ Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE }; } return new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE};
3.修改AlbumModel::queryif (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { if (PermissionChecker.checkSelfPermission(context, Manifest.permission.READ_MEDIA_IMAGES) != PermissionChecker.PERMISSION_GRANTED) { if (null != callBack) callBack.onAlbumWorkedCallBack(); return; } } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { if (PermissionChecker.checkSelfPermission(context, Manifest.permission.READ_EXTERNAL_STORAGE) != PermissionChecker.PERMISSION_GRANTED) { if (null != callBack) callBack.onAlbumWorkedCallBack(); return; } }
完美解决
不是Q,是TIRAMISU
您好,钟裕达已经收到您的来信并会尽快查收,谢谢!
确实得适配android13,别告诉我到这就终止了吧 - -!