@@ -24,7 +24,7 @@ There are 5 ways to install this plugin:
24
24
25
25
### Android Setup
26
26
27
-
Set **Write Permission** to **External (SDCard)** in **Player Settings**. You can skip this step if your app won't be saving media to the Gallery but instead just reading media from it.
27
+
NativeGallery no longer requires any manual setup on Android.
28
28
29
29
### iOS Setup
30
30
@@ -121,14 +121,15 @@ Beginning with *6.0 Marshmallow*, Android apps must request runtime permissions
121
121
122
122
There are two functions to handle permissions with this plugin:
123
123
124
-
`NativeGallery.Permission NativeGallery.CheckPermission( PermissionType permissionType )`: checks whether the app has access to Gallery/Photos or not. **PermissionType** can be either **Read** (for *GetImageFromGallery/GetVideoFromGallery* functions) or **Write** (for *SaveImageToGallery/SaveVideoToGallery* functions).
124
+
`NativeGallery.Permission NativeGallery.CheckPermission( PermissionType permissionType, MediaType mediaTypes )`: checks whether the app has access to Gallery/Photos or not. **PermissionType** can be either **Read** (for *GetImageFromGallery/GetVideoFromGallery* functions) or **Write** (for *SaveImageToGallery/SaveVideoToGallery* functions).
125
+
-**mediaTypes** determines for which media type(s) we're checking the permission for. Has no effect on iOS
125
126
126
127
**NativeGallery.Permission** is an enum that can take 3 values:
127
128
-**Granted**: we have the permission to access Gallery/Photos
128
129
-**ShouldAsk**: we don't have permission yet, but we can ask the user for permission via *RequestPermission* function (see below). On Android, as long as the user doesn't select "Don't ask again" while denying the permission, ShouldAsk is returned
129
130
-**Denied**: we don't have permission and we can't ask the user for permission. In this case, user has to give the permission from Settings. This happens when user denies the permission on iOS (can't request permission again on iOS), when user selects "Don't ask again" while denying the permission on Android or when user is not allowed to give that permission (parental controls etc.)
130
131
131
-
`NativeGallery.Permission NativeGallery.RequestPermission( PermissionType permissionType )`: requests permission to access Gallery/Photos from the user and returns the result. It is recommended to show a brief explanation before asking the permission so that user understands why the permission is needed and doesn't click Deny or worse, "Don't ask again". Note that the SaveImageToGallery/SaveVideoToGallery and GetImageFromGallery/GetVideoFromGallery functions call RequestPermission internally and execute only if the permission is granted (the result of RequestPermission is also returned).
132
+
`NativeGallery.Permission NativeGallery.RequestPermission( PermissionType permissionType, MediaType mediaTypes )`: requests permission to access Gallery/Photos from the user and returns the result. It is recommended to show a brief explanation before asking the permission so that user understands why the permission is needed and doesn't click Deny or worse, "Don't ask again". Note that the SaveImageToGallery/SaveVideoToGallery and GetImageFromGallery/GetVideoFromGallery functions call RequestPermission internally and execute only if the permission is granted (the result of RequestPermission is also returned).
132
133
133
134
`NativeGallery.OpenSettings()`: opens the settings for this app, from where the user can manually grant permission in case current permission state is *Permission.Denied* (on Android, the necessary permission is named *Storage* and on iOS, the necessary permission is named *Photos*).
// Interacting with Gallery/Photos is only possible when permission state is Permission.Granted. Most of the functions request permission internally (and return the result) but you can also check/request the permissions manually
// If permission state is Permission.Denied, user must grant the necessary permission (Storage on Android and Photos on iOS) manually from the Settings. These functions help you open the Settings directly from within the app
116
117
void NativeGallery.OpenSettings();
@@ -131,6 +132,8 @@ async Task<Texture2D> NativeGallery.LoadImageAtPathAsync( string imagePath, int
131
132
// maxSize: determines the maximum size of the returned Texture2D in pixels. Larger thumbnails will be down-scaled. If untouched, its value will be set to SystemInfo.maxTextureSize. It is recommended to set a proper maxSize for better performance
132
133
// captureTimeInSeconds: determines the frame of the video that the thumbnail is captured from. If untouched, OS will decide this value
0 commit comments