[英]How do ask a permission for open a gallery in android phones using flutter
我使用 image_picker: ^0.8.4+11 打開畫廊。 我需要申請開畫廊的許可。 在 iOS 中它要求打開畫廊的權限,但在 Android 中它沒有要求權限
我在我的 AndroidManifest 文件中試過這樣
但這對我不起作用。 請問有人可以幫我解決這個問題嗎?
提前致謝。
// 這些權限需要添加到您的 AndroidManifest.xml
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
// Add these to android/grade.properties file.
android.useAndroidX=true
android.enableJetifier=true
// Get from gallery
_getFromGallery() async {
PickedFile pickedFile = await ImagePicker().getImage(
source: ImageSource.gallery,
maxWidth: 1800,
maxHeight: 1800,
);
if (pickedFile != null) {
File imageFile = File(pickedFile.path);
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.