Posted by Yacine Rezgui – Developer Relations Engineer
Enhancing privateness stays a prime precedence on Android. We have been investing within the platform to provide customers extra management, improve transparency, and cut back the scope of entry to non-public knowledge.
Final 12 months, we launched a brand new function to emphasise this technique: the Android picture picker. The picture picker is a browsable interface that presents the consumer with their media library, sorted by date from latest to oldest, and integrates properly along with your app’s expertise with out requiring media storage permissions!
It permits customers to browse their picture gallery and grant entry to particular gadgets to an app. It’s a robust instrument permitting you to shortly add a photograph choice function to your apps with out having to develop a fancy in-house picker from scratch. It additionally eliminates the necessity to keep advanced logic for dealing with permissions and querying MediaStore, enabling you to avoid wasting effort and time that may in any other case be spent on coding and debugging.
The picture picker is straightforward to implement, as you solely want to incorporate a couple of strains of code with the help library. Moreover, it’s extremely configurable, so you’ll be able to customise the consumer expertise based on your app’s particular wants.
Availability throughout all Android variations
One key piece of suggestions we’ve heard from builders is the shortage of help for older gadgets, making upkeep pricey by way of growth. We’re happy to announce that, as a part of the ActivityX 1.7.0 launch, the Picture Picker help library will use a backported model supplied by Google Play providers on gadgets working Android KitKat (4.4) and later!
To allow the backported picture picker:
- Replace the ActivityX dependency to the model 1.7.0
- Add the following code snippet that adds the Google Play Services module dependency in your AndroidManifest.xml. It instructs Google Play services to set up the backported photo picker module while installing or updating your application (you can read more in the documentation.
Register an exercise end result with PickVisualMedia or PickMultipleVisualMedia and launch the picture picker.
And that’s it! In lower than 10 strains of code, you will have a permission-less picture picker with a pleasant UX that blends effectively into your software, and you’ve got a single code path for sustaining the function’s performance for all Android variations working KitKat and above.
Since our last blog post, we began rolling out help for the GET_CONTENT intent within the Android picture picker each time the desired MIME sort filter matches picture/* and/or video/*. Because the rollout will proceed within the upcoming months, make certain to check your app as soon as your gadget has the function enabled:
adb shell device_config put storage_native_boot take_over_get_content
Later this 12 months, the picture picker will seamlessly help cloud storage suppliers like Google Photographs, permitting customers to pick their distant content material with out having to go away your app, and with none code change on the builders facet.
You probably have any suggestions or recommendations, submit tickets to our issue tracker.