Empty cursor from MediaStore

I cannot understand why this cursor is empty only in this particular device. but works on all other Android devices. There are several audio files on the SD card, and the media player can find and play these songs in order.

Cursor c = managedQuery(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, new String[] { "distinct " + MediaStore.Audio.Media.ALBUM, MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media.ALBUM_KEY, MediaStore.Audio.Media.ALBUM_ID}, 
                null,
                null, 
                MediaStore.Audio.Media.ARTIST);

Both players are in the bookmaker's office (I assume that they simply go through the folders and perform their own id3 analysis), and the music player in the Android warehouse will find the music, but I can not get anything from the mediator. There are no ".nomedia" files, I tried to insert new mp3 files into a new folder.

+3
source share
2 answers

I came across a similar one and found several answers, of which none have yet been satisfactory.

- Intent ACTION_MEDIA_MOUNTED, . , , , .

, , > > > - . , . , , -dev-.

mContext.sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse
        ("file://" + Environment.getExternalStorageDirectory()))); 

- ACTION_MEDIA_SCANNER_FINISHED.

, MediaScannerConnection, .

, , Google Nexus, INTERNAL_CONTENT_URI.

+2

HTC Incredible, , , DJC . EXTERNAL_CONTENT_URI, INTERNAL_CONTENT_URI . , , URI , HTC Incredible.

Uri contenturi = Images.Media.getContentUri("phoneStorage");
+4

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


All Articles