New Photo Picker on Android 13/API Level 33 - Backwards Compatible
Estimated read time: 1:20
Learn to use AI like a Pro
Get the latest AI workflows to boost your productivity and business performance, delivered weekly by expert consultants. Enjoy step-by-step guides, weekly Q&A sessions, and full access to our AI workflow archive.
Summary
In Stevdza-San's video, the new photo picker introduced with Android 13/API Level 33 is showcased. This photo picker provides a secure and built-in method for users to select images or videos without granting access to their entire media library, offering a modern and simple user interface. Furthermore, this new tool is backwards compatible, with a support library that invokes a different method on devices with older Android versions, ensuring broad usability.
Highlights
The photo picker is available for Android 13/API 33, offering new security and UI π.
Support library ensures operation down to Android 4.4/API 19, with no compatibility issues π.
Modern UI slides up from bottom, only half-screen, allowing easy media browsing β¨.
Itβs possible to select multiple images or videos on Android 13 πΌοΈ.
Older devices gracefully degrade to using the action open document intent π.
Key Takeaways
The new photo picker is a safe and modern way to select media without full library access π.
Backward compatibility is assured, working as far back as Android 4.4/API 19 π€.
Users can enjoy a sleek UI from the bottom of their screens while picking media π±.
The picker also supports multiple selections for Android 13 users π.
Older devices will switch to an alternative method seamlessly without errors βοΈ.
Overview
The latest Android update comes packed with a new, exciting feature: a photo picker that changes the game for accessing media files. Designed to ensure users' privacy, this picker allows users to select media without granting apps access to the entire library. It's sleek, it's secure, and available with the latest Android version!
This video by Stevdza-San shines a light on how developers can implement this feature in their apps. He demonstrates its easy functionality and backward compatibility with devices as old as Android 4.4. This ensures a broader user base can enjoy the updated, streamlined experience. Security and functionality combine to make accessing media a breeze!
What stands out is the pickerβs user-friendly interface. Instead of taking over the whole screen, it elegantly slides up, giving users a glimpse of their media library organized neatly by date. Plus, for those on Android 13, the option to select multiple images or videos enhances usability. For older devices, a reliable alternative method kicks in, maintaining a smooth user experience.
Chapters
00:00 - 01:00: Introduction and Overview The chapter 'Introduction and Overview' introduces a new photo picker available in Android 13 (API level 33). This feature allows users to select images and videos safely without granting applications access to their entire media library. The photo picker is described as both browsable and searchable, providing a secure and user-friendly experience.
01:00 - 02:30: Photo Picker UI Explanation The chapter 'Photo Picker UI Explanation' discusses a new intuitive interface for accessing the media library, sorted from newest to oldest. This modern photo picker, activated by a simple intent, features a streamlined UI occupying half of the screen. The chapter promises a demonstration of its appearance and further explanation, including the underlying code.
02:30 - 04:30: Compatibility with Older Devices The chapter discusses ensuring compatibility with older devices while using an API level of 33. It focuses on the implementation of an async image composable function from the Coil image loading library. The chapter describes the functionality of a button that checks for the availability of a new photo picker on the device. When the button is pressed, a toast message indicates if the device supports the new photo picker, with 'true' indicating support.
04:30 - 10:30: Code Explanation The chapter titled 'Code Explanation' describes how to use a new photo picker feature. It explains that by pressing a specific image asynchronously, a photo picker appears from the bottom of the screen instead of covering it completely. On the emulator used, only two images are displayed, but the picker allows scrolling to view all available images on the device. Additionally, there is an option to view different albums.
10:30 - 11:00: Conclusion and Call to Action In this chapter, the focus is on the new photo picker feature available from Android 13, demonstrating how to browse and select images on a device. The chapter reassures readers that the code provided is backward compatible, meaning it can still function on older Android devices, ensuring broad usability and application. This conclusion serves both as a summary of the technical features discussed and as a call to action to encourage integration of this feature into applications.
New Photo Picker on Android 13/API Level 33 - Backwards Compatible Transcription
00:00 - 00:30 foreign welcome back to my new videos so in this video I am going to show you a new photo picker that is available with a new Android 13 or a API level 33 so this tool provides a safe and a built-in way for users to select a single or multiple images and videos without needing to Grant your application and access to their entire Media Library it offers a browsable and searchable
00:30 - 01:00 interface that presents the user with their media library sorted by date from the newest to the oldest this is a new photo picker is a different from a regular one that we are actually triggering with a simple intent because it offers a modern and simple UI on the half of the screen now let me show you how it actually looks like and then I will tell you some more interesting things about it and explain you the actual code as well so this is our Android emulator that
01:00 - 01:30 uses an API level of 33 and on the center here we have just a wanna async image composable function which is a part of a coil image loading library and here we have one button that has only one function to actually check whether it is a new photo picker is available on our actual device so whenever I press this button then we should receive here a toast message saying either true or false so here we have received true and it means that our device actually supports this new photo picker so if I
01:30 - 02:00 press this async image and then our photo picker will appear there you go so this is how that the new photo picker actually looks like so it doesn't cover the full screen it actually just comes from the bottom and from here of course at the moment on this emulator I have only two images but but if you have some more images then you will be able to scroll all the way down to see all your images that are available on your device we also have this albums option as well and we can
02:00 - 02:30 check out the different albums on our device as well so there you go that's how it actually looks like and we can of course select one of those images and in the logcat we are going to receive the actual URI of that the same image so there we go so I have already told you that this new photo picker is available from my Android 13 right however that doesn't mean that this code that I have already written here is not compatible with older devices quite the opposite so
02:30 - 03:00 if the photo picker is not available on a device then the support Library will automatically invoke the action open document intent instead and that intent is supported on a devices that runs on an Android 4.0 or sorry 4.4 or API level 19 or higher so there are no any compatibility issues there is also one a useful function that will allow you to check whether that a new photo picker is available on the
03:00 - 03:30 running devices and that function is called the is a photo picker available I'm going to show you that a little bit later and now let's try and run this photo picker on a device for example with an API level of an 29 and let's see how all that actually look like on those devices that this photo picker is not directly available okay so now if I press this async image on the center and then we are not going to see that
03:30 - 04:00 the actual uh new photo picker because that photo picker is available only on a API level 33 but we are not going to get any error instead on older devices data action open document intent will be triggered instead so everything will work the same as before now let me show you the actual code here so of course I'm using a composable here and composable function so I have just created one image URI a variable that will be changed dynamically from our
04:00 - 04:30 code its default value is this drawable which is a picker this is a custom UI element that I have designed for this purpose there we go so that will be a default image visible in our actual screen after that I have created here one variable uh and initialize this remember launcher for activity result and specified a specific contract which is called the pick visual media right so uh here it says that this activity a result contract will be used to actually
04:30 - 05:00 pick the photo by using this media store action pick images when it's available and it will be available if you're using an Android 13 otherwise if you're using some older devices then this action open document will run instead so here we have specified just the one if block so if that URI is not empty and it means that we have actually selected some image from our photo picker in that case I have applied that URI to this image URI variable and this image URI is of
05:00 - 05:30 course observed from this async image composable function from a coil image loading Library so whenever we change this image URI and that will be whenever we pick that image from that photo picker then our image here will update and also whenever we click this async image then this photo picker will call and Trigger this launch function and there we have just specified this epic virtual media request so that we can actually request the image from the
05:30 - 06:00 photo picker now this photo picker accepts not just the image but also a videos as well or image in the video right so there are a couple of different options here there we go so image only image and video and video only as well now below that we have this availability button that does trigger this is photo picker available function and that function basically checks whether our current device actually supports this new uh photo picker right so it will return true if it does or false if it
06:00 - 06:30 doesn't so this is how our actual code looks like so basically whenever we select that async image and click on that we're going to trigger this photo picker and request the image right now you can also request the multiple images as well and you can do that for example by creating here a new variable so let's create here a multiple photo picker let's call again here this remember launcher for activity result as a contract here I'm going to specify a activityresultcontracts.pic a multiple
06:30 - 07:00 visual media right so here we can also specify one parameter which is the max items and we can specify how many items from our photo picker we want to actually choose so so far we have used this peak visual media which will allow us to choose only one media or one photo or video from that color or a sorry photo picker however in this case now we can specify more than one of course so in this case we can just um call here a
07:00 - 07:30 multiple photo picker and then let's see how will that look like so let's hear trigger our newest Android version or API level 33 so now whenever we are using this multiple photo picker and then here as you can see now we have an option to select multiple items and of course if you try to select uh more items from here then uh then the number that you have specified in this code then you're going to receive here a message that you cannot do that right also an important
07:30 - 08:00 thing here to note is that if the photo picker is not available in the supported Library invokes this uh all the action open document intent on those other devices so if you try to use that multiple selection with this older device then that the maximum number that we have specified right here will be ignored right so here as you can see if we try to for example run this on our older devices and try to select multiple items
08:00 - 08:30 then that will not be available right okay so that's everything I wanted to share with you in this video about uh the new photo picker so now you have seen that this new photo picker actually uh has a quite modern and simple UI it's very easy to select multiple items from this uh photo picker in the Android 13. so be sure to leave a comment down below and tell me what you think about this new API and also uh be sure to like
08:30 - 09:00 this video but only if you find it helpful for this video that will be all God oh my God if I die I'm a legend when they lay me down to rest