Media Management with Android MediaStore

I control the means (images, sound) of my application directly by reading and saving to the SD card. Should I use MediaStore instead? I'm not quite sure what the MediaStore is for, and javadoc doesn't really help.

When should an application use MediaStore? A brief overview of the pros and cons of MediaStore will be greatly appreciated.

+4
source share
2 answers

I am not an expert in this, but as far as I understand, well, this is an easy way to search for specific types of files.

If your application has its own library, then using MediaStore instead of finding all by itself is more useful, faster and less energy-intensive. You can also be sure that these are all the files present in the system.

Hope this helps.

+3
source

As an avid Android user.

I think that MediaStore is a “Public Link” between the Android Media Scanner internal application (you can manually run it through spare parts) and third-party applications such as yours.

I assume MediaStore is a “public link” based on its android.provider package.

As providers in android, how applications provide information to other applications

If MediaStore is a ContentProvider, reading the information filled out by MediaScanner.

Then MediaStore is designed for custom media such as music, video, images, etc.

For ringtones, notifications; I think you should use android.media.RingtoneManager

Also do not recode the path "/ sdcard /" There is an api call to get it, Environment.getExternalStorageDirectory ()

http://twitter.com/cyanogen/status/13980762583

====

The pro is that Media Scanner launches every time you mount removable storage onto your phone, and also scans the internal memory (if it has something like HTC EVO and is incredible)

+4
source

Source: https://habr.com/ru/post/1308570/


All Articles