Closed xiao-gy closed 3 months ago
The example works on all API levels, no?
The example works on all API levels, no?
I don't konw.But it doesn't work properly on Android 13 (at least that's when I tested it).
I think I might need to test this function individually on Android 13.I'll try tomorrow.
I think I might need to test this function individually on Android 13.I'll try tomorrow.
I try to write a simple code to verify this issue.The code is as follow:
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
abc();
bcd();
return Scaffold();
}
void abc() async{
await Permission.photos.status;}
void bcd() async{
final PermissionState ps = await PhotoManager.requestPermissionExtend();
}
}
And I write these in AndroidManifest.xml
:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
I run this code on Android 13 and Android 14 respectively and I got different result of ps. On Android 13 ,I got ps = PermissionState.denied
. But on Android 14,I got ps = PermissionState.limited
.
Did you use the example to reproduce? Or it's your own project?
Did you use the example to reproduce? Or it's your own project?
I just created a new project to verify the functionality of final PermissionState ps = await PhotoManager.requestPermissionExtend();
.
The example works on all API levels, no?
Please verify.
The example works on all API levels, no?
Please verify.
Sry,I'm rookie in Android development, so I am not sure what you are referring to. QAQ
This is my config in build.gradle
.
android {
namespace "com.example.untitled"
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
compileSdkVersion 34
defaultConfig {
...
flutter.minSdkVersion
minSdkVersion 21
targetSdkVersion 33
}
}
Run the example on Android 13 devices and see if the issue persist.
I'm going to bed now. I'll try it out when I wake up.
Thank you for your help!
I have resolved the above issue. It may have been caused by incomplete permissions declared in my AndroidManifest.xml. After referring to the example, I was able to resolve this problem successfully.
Thanks!
Version
3.0.0-dev.5
Platforms
Android
Device Model
Android Virtual Device(Android 13)
flutter info
How to reproduce?
When I run
final PermissionState ps = await PhotoManager.requestPermissionExtend();
on Android 13, the value ofps
is alwaysPermissionState.denied
, which causes an error when I use the camera module of wechat_camera_picker. However, the same code works fine on Android 14, so I believe it's not a lack of necessary permissions, but rather an error in the return ofPhotoManager.requestPermissionExtend()
. I have tried assigningps
a value ofPermissionState.limited
, and the code works fine on Android 13, which further indicates thatrequestPermissionExtend()
is returning incorrect data.I have tested this on Android 11, 13, and 14, and this issue only occurs on Android 13. I hope this can be fixed.
Logs
Example code (optional)