Comments (26)
Thank you so much for your hard-work, But I don't know much about Java so I will use this package once you add support for read data.
Additional note
Please note that once we get the Persisted-Uri, Package should read all the files from the specific folder without user interaction.
So we can show all the data in App UI every time whenever user open up the app.
Once again Thank you so much for this amazing package :)
from shared-storage.
Hey @ankitparmar007! g'afternoon
Your usecase is to get large data sets? Like a folder with 1000+ files?
from shared-storage.
Hey @LaksCastro
Glad to know that you are putting so much effort on this package :) Thank you so much for that !
Based on this URI
content://com.android.externalstorage.documents/tree/primary%3AAndroid%2Fmedia%2Fcom.whatsapp%2FWhatsApp%2FMedia%2F.Statuses
I am trying to read WhatsApp Statuses folder from this path => Android/media/com.whatsapp/WhatsApp/Media/.Statuses
So there is a possibility if user have business account or large user base in WhatsApp account then, Statuses may be available up-to 500 or more including images and videos.
As I can see that in 11 you have mentioned that you are facing issue for reading files which folder has so many files in it.
In my opinion you can limit the number of files reads up-to 1000 if you have no any other solution available currently.
Addition Note
I forget to mentioned in my last issues that openDocumentTree() will open the root directory and user have to manually navigate to this PATH like Android/media/com.whatsapp/WhatsApp/Media/.Statuses, would be appreciated if you add a property like this openDocumentTree(Path = "Android/media/com.whatsapp/WhatsApp/Media/.Statuses") so we can change Path parameter for easy navigation :)
If you need any other Help, For testing the package or live help on social media where we can easily communicate, I would really like to connect with you on you preferred social media account :)
from shared-storage.
Hey! Thanks for sharing your usecases.
Okay, I think I got your needs, this is about WhatsApp statuses and you need the initialDir
. Is really useful to know what you need, to keep the focus on the priorities. Thanks for that.
Also, I think you'll need an way to export these files to another location, so maybe I also need to include some copy
API in this next release.
- So I'll finish the "database query" (Fix large data set issue)
- Add
initialDir
param - Add
copyTo
API to allow you export the statuses
Btw, my Discord is always open laks#1712
, thanks for using the package :)
from shared-storage.
Hardcoded WhatsApp Status Media URI to use as initialUri
when prompting the user
content://com.android.externalstorage.documents/tree/primary%3AAndroid%2Fmedia/document/primary%3AAndroid%2Fmedia%2Fcom.whatsapp%2FWhatsApp%2FMedia%2F.Statuses
Usage:
const kWhatsAppStatusUri = '...';
/// Prompt user with a folder picker (Available for Android 5.0+)
await openDocumentTree(initialUri: Uri.parse(kWhatsAppStatusUri));
from shared-storage.
where do you'll get the assigned path
?
from shared-storage.
Closing this issue as resolved since all mentioned use-cases are now available in v0.4.x
.
Please, you can always re-open this one or open a new issue. Any other bug-reports, questions or feature requests are always welcome!
Thanks for taking time to contribute to this package.
from shared-storage.
Thanks for the issue, what kind of error are you having?
from shared-storage.
If I understood correctly, you don't need the read permission
because currently the package always grants write permission
If you have the write permission
we don't need the read permission
from shared-storage.
how can I read all the data from below given specific folder URI ?
Ex. content://com.android.externalstorage.documents/tree/primary%3AAndroid%2Fmedia%2Fcom.whatsapp%2FWhatsApp%2FMedia%2F.Statuses
from shared-storage.
Unfortunately this usecase is not currently supported, but I added this as a new feature request in #11, I'm planning to implement it on this weekend. Feel free to implement it by yourself if you want! Thanks for the issue.
from shared-storage.
Ya I think You need to copy or cached all the files from URI specified folder to application cached folder for easy read I guess,
Also I have sent a friend request on Discord for effective communication.
from shared-storage.
@lakscastro Good to see you working on package again :)
I have a quick tip for you that might help for caching data into temp directory of the user App using this open source package code https://pub.dev/packages/path_provider
Syntax to get application specific temp directory using path provider package
Directory tempDir = await getTemporaryDirectory();
String tempPath = tempDir.path;
Maybe You can store all the data given by openDocumentTree() method and store it in application specific cache folder(path given by tempPath) so app owner can easily clean up temp folder for storing more fresh data or can be deleted easily when there is no need of it.
Thank you so much again :)
from shared-storage.
yeah, of course, you can store the path wherever you want. You can also use a package like shared_preferences
to store de data. Thanksful for the tip! =]
I mean that this specific path of the WhatsApp status is not available to get it from anywhere, so we need to hardcode it to use as initialDir
But be aware that this is the solution that I'm trying, you can send me any solutions that you think that will fill better our usecase!
from shared-storage.
@lakscastro
I think shared_preferences
cannot store images and videos, and we need to cache images and videos for instance, then application specific temp directory only be helpful for storing temporary data, in my opinion
Also end user won't pass any path to initialDir parameter, Only app developer can assign path to initialDir to open a specific folder, so in my opinion you don't need to hard-code WhatsApp Statuses Path.
If app Developer don't want to assign anything to initialDir then root directory will be open otherwise assigned path will be open using openDocumentTree().
If you didn't get it, no problem just let me know what you didn't understand, I will share video example on discord :)
from shared-storage.
@lakscastro
/// Get permissions to manage an Android directory using shared_storage package
final selectedUriDir = await openDocumentTree();
print(selectedUriDir);
currently we can get WhatsApp Statues folder path by first opening root directory using openDocumentTree(); method and later user has to travel to this path /storage/emulated/0/Android/Media/com.whatsapp/WhatsApp/Media/.Statuses/
later openDocumentTree() method return the path for user selected folder and as you mentioned in above comment we can store same path in shared_preferences
so user doesn't have to travel all the time and we can use same path for future use that's a good thing :)
But my point is can we read all the files from this path /storage/emulated/0/Android/Media/com.whatsapp/WhatsApp/Media/.Statuses/
without user interaction after we get the read permission from the user for the first time ?
below is an example for how we can read files
@override
void initState() {
super.initState();
var data = await openDocumentTree(initialUri: Uri.parse("content://com.android.externalstorage.documents/tree/primary%3AAndroid%2Fmedia/document/primary%3AAndroid%2Fmedia%2Fcom.whatsapp%2FWhatsApp%2FMedia%2F.Statuses%2FMedia"));
}
later we can show data in APP UI ???
also when calling openDocumentTree() method for the first time we can set initialDir path like this
final selectedUriDir = await openDocumentTree(initialDir="/storage/emulated/0/Android/Media/com.whatsapp/WhatsApp/Media/.Statuses/");
consider a point in this case we know the path already so we can directly assign path to initialDir parameter so user doesn't have to travel for the first time also and user can give the permission to read all the data from specified path :)
Hope you get my point :)
from shared-storage.
currently, path/to/something/will/not/work
due the SAF API, they removed completely the File
based API to work with files. Now we need to use the DocumentFile
based API that is based on URIs
from shared-storage.
Ohh that's a bad news :(
So you mean we can't use File App to get the user specified forlder which is inbuilt in almost every android phone ?
from shared-storage.
No, I mean that we just need to use SAF (Android 5.0+)
Most File
APIs are now available in the DocumentFile
API
Starting from new Android APIs (API Level 30+) File
based APIs are not available anymore
from shared-storage.
Bro Lets discuss on discord for effective and fast communication :)
from shared-storage.
Oh, of course
from shared-storage.
@lakscastro hey bro
I think I have found a solution !
https://www.youtube.com/watch?v=1evcTdwZxwM
As show in this video we can read all files directly using uri for example
image uri would be like this
content://com.android.externalstorage.documents/tree/primary%3AAndroid%2Fmedia/document/primary%3AAndroid%2Fmedia%2Fcom.whatsapp%2FWhatsApp%2FMedia%2F.Statuses%2FMedia%2Fimage1.jpg
Decoded image uri looks like this
content://com.android.externalstorage.documents/tree/primary:Android/media/document/primary:Android/media/com.whatsapp/WhatsApp/Media/.Statuses/Media/image1.jpg
or for video uri looks like this
content://com.android.externalstorage.documents/tree/primary%3AAndroid%2Fmedia/document/primary%3AAndroid%2Fmedia%2Fcom.whatsapp%2FWhatsApp%2FMedia%2F.Statuses%2FMedia%2Fvideo1.jpg
so can you try like this once we select the directory using openDocumentTree() then this method should return LIST OF URIs for all the files located in selected folder
from shared-storage.
@ankitparmar007 @lakscastro Hello folks. Does this package support the reading files from the Android folder using SAF DocumentTree yet? :)
from shared-storage.
@jvoltci not fully ! This package needs more improvements
from shared-storage.
Hey @ankitparmar007 ! Let's evolve this package because I researched and could not find any relevant package for this problem. Let's catch up, ping me on @jvoltci tweeter if are up!
from shared-storage.
Hey @jvoltci Sorry to say but, I am not a twitter user ! you can connect with me on discord using this username ankit007#2133
from shared-storage.
Related Issues (20)
- Add request for file writing HOT 2
- Outdated Kotlin Gradle plugin version HOT 2
- Add button to rename a document in the example project
- Can we change the methods to take folder/file paths rather than URIs? HOT 3
- Adding this plugin results in Build failed with an exception HOT 6
- Check if folder exists or not HOT 1
- List files in subdirectories ? HOT 1
- `DocumentFile.findFile` causes ANR HOT 2
- Kotlin version errors HOT 2
- ANR may occur when used with apps that provide document providers
- Unable to build due to missing namespace in module HOT 1
- I want to access this path but it cannot allow me please check
- Build fails on latest flutter beta HOT 2
- createFile fails on network content providers
- java.lang.SecurityException HOT 2
- Documentation outdated
- Compilation error due to mismatch between compileDebugJavaWithJavac and compileDebugKotlin
- openDocumentFileWithResult - OpenDocumentFileResult.failedDueActivityNotFound
- What is the recommended alternative since this package is deprecated HOT 2
- shared_storage - Discontinued HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shared-storage.