I hope you're having a good day :)
Let's get to the point... In my manifest file I have added a receiver like this :
<receiver android:name="com.example.app.AndroidMusicBroadcastReceiver" android:exported="false">
<intent-filter>
<action android:name="com.android.music.metachanged" />
</intent-filter>
</receiver>
I've also created the class com.example.app.AndroidMusicBroadcastReceiver .
public class AndroidMusicBroadcastReceiver extends BroadcastReceiver {
public AndroidMusicBroadcastReceiver() {
// TODO Auto-generated constructor stub
}
@Override
public void onReceive(Context arg0, Intent arg1) {
Log.v("myapp","Artist : "+arg1.getStringExtra("artist"));
Log.v("myapp","Song : "+arg1.getStringExtra("track"));
}
}
And it works... But for some reason the Log thing happens twice in a row every time the song changes. Like this :
How come ? Also am I right to assume that my only option if I want to use this information (artist, track) later, is to save it in a file somewhere ?