I'm doing some experiments with the MediaStore class, saving my images and videos with custom data to read it later. It works fine, I find the way to set the parameters to my media items and I'm able to read them in my phone.
For example, I'm recording a video in fastmotion and to save the information to make my app "know" that it is a fastmotion video to make some custom UI stuffs, I add a text in my MediaStore.Images.ImageColumns.DESCRIPTION
field.
It works fine, but if I copy my file to my computer, or other phone and I try to read the metadata again, everything is empty least:
MediaStore.Images.ImageColumns.TITLE
MediaStore.Images.ImageColumns.ORIENTATION
MediaStore.Images.ImageColumns.MIME_TYPE
How can avoid this? Do you have some other idea to save a custom info in my files to read it later with a different application?
Right now I'm saving this data:
static final String[] QUERY_PROJECTION = {
MediaStore.Images.ImageColumns._ID, // 0, int
MediaStore.Images.ImageColumns.TITLE, // 1, string
MediaStore.Images.ImageColumns.MIME_TYPE, // 2, string
MediaStore.Images.ImageColumns.DATE_TAKEN, // 3, int
MediaStore.Images.ImageColumns.DATE_MODIFIED, // 4, int
MediaStore.Images.ImageColumns.DATA, // 5, string
MediaStore.Images.ImageColumns.ORIENTATION, // 6, int, 0, 90, 180, 270
MediaStore.Images.ImageColumns.WIDTH, // 7, int
MediaStore.Images.ImageColumns.HEIGHT, // 8, int
MediaStore.Images.ImageColumns.SIZE, // 9, long
MediaStore.Images.ImageColumns.LATITUDE, // 10, double
MediaStore.Images.ImageColumns.LONGITUDE // 11, double
MediaStore.Images.ImageColumns.DESCRIPTION // 12, String
};
If necessary, I'd be open also to another way to save additional information in the files to read it later.
I add a text in my MediaStore.Images.ImageColumns.DESCRIPTION field.
This adds a value in a database. It does not modify your video.
It works fine, but if I copy my file to my computer, or other phone and I try to read the metadata again, everything is empty
The data in MediaStore
is not somehow stuffed into the file. For example, setting the value in the DESCRIPTION
column in MediaStore
for a text (.txt
) file does not somehow modify the text in that file to contain the DESCRIPTION
.
Do you have some other idea to save a custom info in my files to read it later with a different application?
Modify your file to contain your desired information.