Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

send track informations via A2DP/AVRCP

I'm trying to send track informations via A2DP/AVRCP. Right now, music is perfectly streamed, but on the "receiver" (ie: car audio), the "track informations screen" is blank (which is not the case using popular players out there). Any idea ?

like image 523
elgui Avatar asked Mar 20 '13 15:03

elgui


1 Answers

This code worked for me:

private static final String AVRCP_PLAYSTATE_CHANGED = "com.android.music.playstatechanged"; private static final String AVRCP_META_CHANGED = "com.android.music.metachanged";  private void bluetoothNotifyChange(String what) {     Intent i = new Intent(what);     i.putExtra("id", Long.valueOf(getAudioId()));     i.putExtra("artist", getArtistName());     i.putExtra("album",getAlbumName());     i.putExtra("track", getTrackName());     i.putExtra("playing", isPlaying());             i.putExtra("ListSize", getQueue());     i.putExtra("duration", duration());     i.putExtra("position", position());     sendBroadcast(i); } 

Call bluetoothNotifyChange with the appropriate intent (defined above) depending on your playback status: pause/playing/metadata changed.

like image 68
William Seemann Avatar answered Nov 13 '22 13:11

William Seemann