mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-14 22:19:29 +01:00
bf66c25c7f
Now the assignment of artist, track and album is correct
33 lines
1.0 KiB
Java
33 lines
1.0 KiB
Java
package nodomain.freeyourgadget.gadgetbridge.externalevents;
|
|
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.os.Bundle;
|
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
|
import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec;
|
|
|
|
public class MusicPlaybackReceiver extends BroadcastReceiver {
|
|
private static final Logger LOG = LoggerFactory.getLogger(MusicPlaybackReceiver.class);
|
|
|
|
@Override
|
|
public void onReceive(Context context, Intent intent) {
|
|
String artist = intent.getStringExtra("artist");
|
|
String album = intent.getStringExtra("album");
|
|
String track = intent.getStringExtra("track");
|
|
|
|
LOG.info("Current track: " + artist + ", " + album + ", " + track);
|
|
|
|
MusicSpec musicSpec = new MusicSpec();
|
|
musicSpec.artist = artist;
|
|
musicSpec.album = album;
|
|
musicSpec.track = track;
|
|
|
|
GBApplication.deviceService().onSetMusicInfo(musicSpec);
|
|
}
|
|
}
|