2015-04-20 22:39:35 +02:00
|
|
|
package nodomain.freeyourgadget.gadgetbridge.externalevents;
|
2015-02-08 23:53:40 +01:00
|
|
|
|
|
|
|
import android.content.BroadcastReceiver;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.util.Log;
|
|
|
|
|
2015-04-20 22:39:35 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.BluetoothCommunicationService;
|
|
|
|
|
2015-02-08 23:53:40 +01:00
|
|
|
public class MusicPlaybackReceiver extends BroadcastReceiver {
|
|
|
|
private final String TAG = this.getClass().getSimpleName();
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onReceive(Context context, Intent intent) {
|
|
|
|
String artist = intent.getStringExtra("artist");
|
|
|
|
String album = intent.getStringExtra("album");
|
|
|
|
String track = intent.getStringExtra("track");
|
|
|
|
|
|
|
|
Log.i(TAG, "Current track: " + artist + ", " + album + ", " + track);
|
|
|
|
|
|
|
|
Intent startIntent = new Intent(context, BluetoothCommunicationService.class);
|
|
|
|
startIntent.setAction(BluetoothCommunicationService.ACTION_SETMUSICINFO);
|
|
|
|
startIntent.putExtra("music_artist", artist);
|
|
|
|
startIntent.putExtra("music_album", album);
|
|
|
|
startIntent.putExtra("music_track", track);
|
|
|
|
context.startService(startIntent);
|
|
|
|
}
|
|
|
|
}
|