I am building auto backup app, where i can auto backup all images and videos, how to aceess device all videos and images by asking photos and videos permission, and now how to get video’s, please help me till Android 14
I am building auto backup app, where i can auto backup all images and videos, how to aceess device all videos and images by asking photos and videos permission, and now how to get video’s, please help me till Android 14
2
Answers
Thank you working ❤️❤️, can I do same using path provider?
To access all images and videos from a device running up to Android 14 (API level 30) in a Flutter app, you’ll need to handle permissions and use appropriate packages. The
permission_handler
package will help manage permissions, andphoto_manager
to fetch media files. Here’s a brief overview of the steps and some code snippets to help guide you:1.Add Dependencies
Add the necessary packages to your pubspec.yaml file.
Then run
flutter pub get
to install the packages.2.Handle Permissions
You need to request permission to access photos and media files.
3.Fetch Images and Videos
You can use the photo_manager package to fetch media files.
4.Handle Android Permissions in the AndroidManifest.xml
Edit your android/app/src/main/AndroidManifest.xml to include necessary permissions:
5.Handle Scoped Storage for Android 11+
For devices running Android 11 (API level 30) and above, you’ll have to handle scoped storage. Consider reading through Android’s scoped storage documentation for more details.
6.Build and Run
After setting everything up, try building and running your app. Ensure that the permissions work correctly, and you are able to fetch images and videos.
Note: Always ensure to handle permissions gracefully and inform the user why the permissions are necessary.