I know that after downloading an mp3 from your app you need to add it to the ContentResolver
to see it on the music player. I am doing it with the following code:
private void addFileToContentProvider() {
ContentValues values = new ContentValues(7);
values.put(Media.DISPLAY_NAME, "display_name");
values.put(Media.ARTIST, "artist");
values.put(Media.ALBUM, "album");
values.put(Media.TITLE, "Title");
values.put(Media.MIME_TYPE, "audio/mp3");
values.put(Media.IS_MUSIC, true);
values.put(Media.DATA, pathToFile);
context.getContentResolver().insert(Media.EXTERNAL_CONTENT_URI, values);
}
My issue is that I am willing to avoid setting DISPLAY_NAME
, ARTIST
, ALBUM
, TITLE
by hand.
Is there a way to tell Android to do it from the file? I've already used just values.put(Media.DATA, pathToFile);
but it's not adding it to the player.
Is there a way to force the thread that scans the sd for music?