Skip to content

Commit 6e14f7d

Browse files
chore(update-plugins): Thu Jan 30 08:05:08 UTC 2025
1 parent 5707ef6 commit 6e14f7d

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

content/plugins/imagepicker.md

+24-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ Add the following permissions to the `App_Resources/Android/src/main/AndroidMani
6868

6969
- **targetSdkVersion >=33(Android 13+)**
7070

71+
These are only required when not setting `android.use_photo_picker = true`.
72+
7173
```xml
7274
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
7375

@@ -76,6 +78,27 @@ Add the following permissions to the `App_Resources/Android/src/main/AndroidMani
7678

7779
See the complete example [here](https://github.com/NativeScript/plugins/blob/main/tools/assets/App_Resources/Android/src/main/AndroidManifest.xml#L14).
7880

81+
### Android Photo picker
82+
83+
For phones running android 13+ specifying the option `android.use_photo_picker = true` when creating the `ImagePicker` will result in the use of the System Photo Picker.
84+
85+
<!-- tabs: TS -->
86+
87+
```ts
88+
let imagePickerObj: ImagePicker = imagePickerPlugin.create({
89+
mode: 'single',
90+
android: { use_photo_picker: true },
91+
})
92+
```
93+
94+
This means you can remove the `READ_MEDIA_IMAGES, READ_MEDIA_VIDEO` permissions and do not have to prompt the user for permission.
95+
96+
Full details [here](https://developer.android.com/training/data-storage/shared/photopicker).
97+
98+
You can also now limit the number of images that are selectable in the Photo Picker by specifying the `maximumNumberOfSelection` option.
99+
100+
For phones running < Android 13, this `use_photo_picker` option has no effect.
101+
79102
### iOS required permissions
80103

81104
Using the plugin on iOS requires the `NSPhotoLibraryUsageDescription` permission. Modify the `app/App_Resources/iOS/Info.plist` file to add it as follows:
@@ -189,7 +212,7 @@ An object passed to the `create` method to specify the characteristics of a medi
189212
| :---------------------------- | :-------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
190213
| `mode` | `string` | `multiple` | The mode of the imagepicker. Possible values are `single` for single selection and `multiple` for multiple selection. |
191214
| `minimumNumberOfSelection` | `number` | `0` | _Optional_: (`iOS-only`) The minumum number of selected assets. |
192-
| `maximumNumberOfSelection` | `number` | `0` | _Optional_: (`iOS-only`) The maximum number of selected assets. |
215+
| `maximumNumberOfSelection` | `number` | `0` | _Optional_: (`iOS-only`, `Android-Photo Picker-Only`) The maximum number of selected assets. |
193216
| `showsNumberOfSelectedAssets` | `boolean` | `true` | _Optional_: (`iOS-only`) Display the number of selected assets. |
194217
| `prompt` | `string` | `undefined` | _Optional_: (`iOS-only`) Display prompt text when selecting assets. |
195218
| `numberOfColumnsInPortrait` | `number` | `4` | _Optional_: (`iOS-only`) Sets the number of columns in Portrait orientation |

0 commit comments

Comments
 (0)