I want to know what the purpose of the system app "Media Storage" and the media scanner is for and why for any reason a user would choose to not scan media on boot.
1 Answer
Media Storage, package name com.android.providers.media
, is an implementation of MediaStore:
The Media provider contains meta data for all available media on both internal and external storage devices.
It scans and stores media file info for quick access, and provides secure (content:///
scheme, as with all other providers) URIs pointing to the files for access by other apps.
By default, Media Storage has a broadcast receiver MediaScannerReceiver
that listens for android.intent.action.BOOT_COMPLETED
, so media scanner will launch on boot. Such receivers are unlikely to be disabled by end users unless with root permissions.
-
Can you explain the purpose of either. You explained the function, what it does, but not its purpose, what it is used for in a utilitarian sense. Apr 28, 2017 at 6:46
-
"It scans and stores media file info for quick access" - so that individual media apps would not need to scan folders manually for an up-to-date library (e.g. painful if you have a lot of music / adds music often); "provides secure URIs" - so as to comply with the overall security mechanism of recent Android versions.– Andy YanApr 28, 2017 at 7:14
-
I thought you were asking the question from a power-user perspective, since you asked "why users would skip scanning".– Andy YanApr 28, 2017 at 7:14
-
1I can't tell you what Google was thinking when they crafted it, but only what I think is reasonable... Individual apps don't necessarily know that a file has been updated, and thus will not retrieve the updated info unless manually asked to (e.g. folder-based players). Media scanner provides a way to scan once and let all apps that uses MediaStore know the updated details (via sending a broadcast indicating the scan is complete).– Andy YanApr 29, 2017 at 9:24
-
1The MediaStore is the database holding the meta-data for all the device files. And the Media Scanner is the service in charge if inserting each file meta-data into the MediaStore database. The files meta-data is the information about file type (audio, video, image, etc), mime-types, image-size, orientations, the file path, and a very long etc. This is the way developers can query such information when creating apps. So, for example, a gallery app can do queries to show lets say albums of only photos or videos, exclude audio, or show images of only a specific type, etc. Dec 16, 2018 at 13:52