-
-
Notifications
You must be signed in to change notification settings - Fork 19
Permissions
In iOS, the required permissions differ depending on the destination. Gal.hasAccess(toAlbum: true)
returns true
when NSPhotoLibraryUsageDescription
is limited
or all
. If you want to put media in an album other than the one your app created, you should avoid using Gal.hasAccess
for confirmation.
Android | iOS | |
---|---|---|
Just put | WRITE_EXTERNAL_STORAGE | NSPhotoLibraryAddUsageDescription or NSPhotoLibraryUsageDescription (limited, all) |
Put to album ur app created | WRITE_EXTERNAL_STORAGE | NSPhotoLibraryUsageDescription (limited, all) |
Put to album ur app not created | WRITE_EXTERNAL_STORAGE | NSPhotoLibraryUsageDescription (all) |
π¨ If you try to save media in an album created by someone other than your app with
NSPhotoLibraryUsageDescription
set tolimited
, your app will create a new album since it cannot reference that album.
Here we will only discuss the versions supported by the latest Flutter stable (Android >= 21
, iOS >= 11
).
Also, there may be changes in the specifications.
In Android <23
, Write permissions to the gallery app are allowed by default.
In Android >=23 && <29
, Writing to the gallery app requires the explicit statement
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="29" />
in the AndroidManifest.xml.
In Android >=29
, Write permissions to the gallery app are allowed by default.
π‘ In older articles and projects, sometimes it is written to add the
android:requestLegacyExternalStorage="true"
key. But the key is basically unnecessary. Because, that was added as a temporary measure when Google changed the system regarding storage and its permissions in Android API 29.
In iOS >=11
, Write permissions to the gallery app requires the explicit statement
<key>NSPhotoLibraryAddUsageDescription</key>
in the info.plist.
- Delivering an Enhanced Privacy Experience in Your Photos App
- NSPhotoLibraryAddUsageDescription
- requestAuthorization(for:handler:)
Talks about the version to which access is not granted by default (Android >=23 && <29
).
It will appear until the user checks the "Never show again" box in the dialog
and chooses to reject it, or until the user chooses to reject it from the app settings.
Due to Apple restrictions, it can basically only be displayed once.