0

I am developing an app that streams internet radio to my car radio via bluetooth. All sound related and remote control stuff works but I have a problem sending metadata to my car radio "Bolero Skoda some Alpine OEM". When I send metadata it is transmitted to the radio but not shown in the display, but if I press "|| PAUSE" on the car radio and send metadata it works, what am I missing out ?. I am guessing that some of my problem is that I am using a never ending stream but there must be a workaround.

Car radio is running AVRCP 1.3. Android CM11 - 4.4.4

1 Answers1

0

Yes, Sorry ! Here it is:

RemoteControlClient mRemoteControlClient = null;

protected void onCreate(Bundle savedInstanceState) {
... 

PendingIntent pi = PendingIntent.getBroadcast(getApplicationContext(), 0, i, 0);
mRemoteControlClient = new RemoteControlClient(pi);

mAudioManager.registerRemoteControlClient(mRemoteControlClient);

int flags = RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS
              | RemoteControlClient.FLAG_KEY_MEDIA_NEXT
              | RemoteControlClient.FLAG_KEY_MEDIA_PLAY
              | RemoteControlClient.FLAG_KEY_MEDIA_PAUSE
              | RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE
              | RemoteControlClient.FLAG_KEY_MEDIA_STOP
              | RemoteControlClient.FLAG_KEY_MEDIA_FAST_FORWARD
              | RemoteControlClient.FLAG_KEY_MEDIA_REWIND;
mRemoteControlClient.setTransportControlFlags(flags);
mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING);

...
}


private void notifyChange()
{
    Thread meta = new Thread(new Runnable()
    {
        public void run()
        {
            mRemoteControlClient
                .editMetadata(true)
                .putString(MediaMetadataRetriever.METADATA_KEY_TITLE, Get_Station())
                .putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, Get_Comment())
                .putLong(MediaMetadataRetriever.METADATA_KEY_DURATION, 3000)
                .apply();
        }
    });
    meta.start();

    try {
        meta.join();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}