Nov 10 | 7:20 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Nov 10 | 7:45 PM |
Kumar V. | has entered the room |
Mark M. |
hello, Kumar!
|
Mark M. |
how can I help you today?
|
Kumar V. |
Hi Mark, Warm greetings.
|
Kumar V. |
View paste
|
Mark M. |
a music player probably should be working off of the MediaStore mostly, though, right?
|
Kumar V. |
Yes, but as said since it is a offline music player to get the content and for other things we use MediaStore
|
Nov 10 | 7:50 PM |
Mark M. |
OK -- I'm happy to try to answer your questions!
|
Kumar V. |
View paste
|
Mark M. |
are the libraries open source?
|
Kumar V. |
Yes
|
Mark M. |
then perhaps fork them, or contribute changes upstream, to get them to work with InputStream or FileDescriptor, things that you can get from a ContentResolver with a Uri to your media
|
Kumar V. |
but One or two isn't
|
Mark M. |
then contact the vendors and ask them when they intend to support InputStream or FileDescriptor
|
Mark M. |
I mean, you are not the only group using these libraries that is in this position
|
Nov 10 | 7:55 PM |
Mark M. |
the libraries need to give you more flexible options for supplying the data
|
Kumar V. |
Ok.
|
Kumar V. |
Will try to raise a issue and follow up with mail with them
|
Mark M. |
you're welcome to continue trying to use the DATA column, but my understanding is that it was unreliable to begin with
|
Mark M. |
and eventually Google is going to do something to break it entirely
|
Mark M. |
so, I recommend trying to "get ahead of the curve" and try to eliminate your dependency on filesystem paths
|
Mark M. |
(at least for files that you are not managing yourself)
|
Kumar V. |
Is it, ok. But the recent official doc says you can use it now
|
Mark M. |
to be honest, I have not looked, because I have heard complaints about DATA over the years, and so I have never used it personally
|
Kumar V. |
Ok.
|
Kumar V. |
Moving onto second question
|
Mark M. |
I have not had complex media needs, and InputStream has been sufficient for me
|
Kumar V. |
We store some files outside our app directory, not large in size though. This kind of works like feature during reinstall or if app data gets cleared.
- What is the best solution for this ? Should we migrate the data to app storage (or) use SAF to get access and continue storing in the external storage.
|
Nov 10 | 8:00 PM |
Mark M. |
I cannot tell you which of those two is "best", as that is based on your own selection criteria
|
Mark M. |
personally, I prefer app storage, for simplicity and leaving less clutter behind in case of an uninstall
|
Mark M. |
but SAF is a reasonable choice, if you can explain to the user why this stuff matters
|
Mark M. |
just bear in mind that SAF != on-device storage, as the user can choose Google Drive and other places
|
Mark M. |
so, while SAF is fine in general, for an offline music player, it may not be the best choice
|
Kumar V. |
View paste
|
Kumar V. |
We will try to decide considering user experience
|
Kumar V. |
Moving onto 3rd question
|
Kumar V. |
Now that we have scoped storage and have to get permission to edit the files, what happens to the ACTION_OPEN_DOCUMENT_TREE permission that we were taking to edit the files in sdcard ? Are both permission unified now ?
|
Nov 10 | 8:05 PM |
Mark M. |
to be clear, what do you mean by "have to get permission to edit the files"?
|
Mark M. |
are you referring to MediaStore.createWriteRequest() ?
|
Kumar V. |
If I had to delete the file / edit the file content using ID3 tag editing
|
Kumar V. |
MediaStore.createWriteRequest() --> yes, this is one part , but to make the changes more persistent we edit at file level as well using some library which does ID3 tag editing.
|
Mark M. |
from our standpoint as app developers, AFAIK, MediaStore.createWriteRequest() is independent from ACTION_OPEN_DOCUMENT_TREE, in terms of permissions
|
Mark M. |
it is possible that there are some connections deep inside Android somewhere
|
Nov 10 | 8:10 PM |
Kumar V. |
Follow up question of the above
|
Kumar V. |
How do we delete media file now with scoped storage on ?
From Android 11 and above you are forced to take uri permission before the edit.
Based on the docs and answers that I read, the delete that we do in media store deletes physical copy of the file as well as the indexed file that is present in media store, this is in Android
However this is not how it works in below Android 11 os, where you have to delete physical file and the entry in media store (or) do a media scan after file is deleted.
So in this case should we be having 2 flows, one delete flow for scoped storage on (Android 11 and above) and one delete flow for below Android 11.
(I am yet to try this)
|
Mark M. |
to be honest, I have no idea -- I do not recall doing any experiments in that area
|
Mark M. |
and deleting media was always confusing with respect to dealing with the file content and MediaStore
|
Kumar V. |
You mean deleting a media file ?
|
Kumar V. |
deleting media was always confusing with respect to dealing with the file content and MediaStore --> Yes
|
Mark M. |
sorry, I was referring to deleting things out of MediaStore, and what the impacts are for the underlying file
|
Kumar V. |
With whatever I had tried sometime back , the above what I have stated is how it works as far as I could remember
|
Mark M. |
it certainly sounds plausible -- it's just not an area that I have worked in
|
Kumar V. |
So just wanted to know if you had any idea related to this, I was finding hard to get something online
|
Kumar V. |
it certainly sounds plausible -- it's just not an area that I have worked in --> Ok, will try out
|
Mark M. |
sorry, while I have done a fair bit on scoped storage, my focus has been more on the SAF side than the MediaStore side
|
Nov 10 | 8:15 PM |
Kumar V. |
I have some questions on SAF, let's say I want to create a folder in root dir of external storage, with the recent change that is not possible right because giving permission to the root directory of external storage is not allowed
|
Mark M. |
correct
|
Kumar V. |
So I have to use one of the existing folder to create my folder ?
|
Mark M. |
yes, or (I think) create the folder outside of the app (e.g., USB cable)
|
Kumar V. |
Sorry, didn't get this
|
Mark M. |
I think the user can create the folder manually by mounting their Android device as a drive using a USB cable and a desktop or notebook
|
Kumar V. |
Ok, is there way to do this programatically as well ?
|
Nov 10 | 8:20 PM |
Mark M. |
AFAIK, no
|
Mark M. |
that is part of the point of these changes
|
Kumar V. |
Yes
|
Kumar V. |
This scoped storage is a good idea from android, but the way it is given to developers is hell
|
Kumar V. |
I don't know how many apps are going to suffer.
|
Mark M. |
locking things down, that used to be open, is always hard
|
Mark M. |
but, even given that, scoped storage has been *messy*
|
Nov 10 | 8:25 PM |
Kumar V. |
That's it Mark. Will try out above things and get back in next office hours If I have anything to ask.
|
Mark M. |
OK, sounds good!
|
Kumar V. |
Thanks for your help.
|
Mark M. |
I'm sorry that I didn't have more and better answers!
|
Kumar V. |
The suggestions was helpful, will explore from here.
|
Kumar V. |
Good day Mark. Bye. :)
|
Mark M. |
see you later!
|
Nov 10 | 8:30 PM |
Mark M. |
that is wrap for today's chat
|
Mark M. |
the transcript will be posted to https://commonsware.com/office-hours/ shortly
|
Mark M. |
the next chat is Thursday at 8:30am US Eastern
|
Mark M. |
have a pleasant day!
|
Kumar V. | has left the room |
Mark M. | turned off guest access |