2014-12-03 6 views
1

Google Play 뮤직에서 2 개의 재생 목록을 만들었지 만 재생 목록이없는 것으로 보입니다. 이 항목의 코드를 사용하고 있습니다. Google Play 뮤직에서 만든 재생 목록을 가져올 수 없음

How can I access playlist created by android default music app and call the music app to play it?

당신은 어떤 사용하는 기본 안드로이드 미디어 스토리지 음악 플레이어에 대한 그 코드를 사용할 수 있습니다 당신의 도움들

답변

3

주셔서 감사합니다. 하지만 Google Play 뮤직에는 자체 데이터베이스가 있습니다. 그래서 다른 uri와 column 이름이 필요합니다.

은 내가 다음 코드를 사용하십시오 재생 목록의 목록을 얻으려면 :

Uri playlistsUri = Uri.parse("content://com.google.android.music.MusicContent/playlists"); 
Cursor playlists = context.getContentResolver().query(playlistsUri, new String[]{"_id", "playlist_name"}, null, null, null); 

이 그럼 당신은 기본 안드로이드 미디어 스토리지의 노래 ID 관련된 노래 ID를 얻을 수 있습니다. 그 후에는 노래를 직접 연주하거나 노래에 대한 세부 정보를 얻어 음악을 만들 수 있습니다.

Uri songsUri = Uri.parse("content://com.google.android.music.MusicContent/playlists/" + playlistId + "/members"); 
context.getContentResolver().query(songsUri, new String[]{"SourceId", "hasLocal"}, null, null, null); 

은이 같은 것을 사용해야합니다 안드로이드에 기본 미디어 저장 장치에서 노래 정보를 얻으려면 : 첫 번째 쿼리는 하나 개의 레코드를 반환

Cursor songDetailsCursor = context.getContentResolver().query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, 
       new String[]{MediaStore.Audio.Media.DATA}, 
       MediaStore.Audio.Media._ID + " = " + songId, 
       null, null); 
+0

. 즉, 마지막으로 생성 된 재생 목록입니다. –