Android Tutorial How to get track change data

ie: If you want to make a music control widget

First you need to add a broadcast listener to the manifest

<action android:name="" />'stock music player
<action android:name="com.miui.player.metachanged" />'MIUI music player
<action android:name="" />'HTC music player
<action android:name="com.nullsoft.winamp.metachanged" />'WinAmp
<action android:name="com.real.IMP.metachanged" />'MyTouch4G

Then add this code to your Service_Start sub

If StartingIntent.HasExtra("track") Then
        MusicCommand =  GetExtra(StartingIntent, "command", "")
        MusicTrack = GetExtra(StartingIntent, "track", "UNKNOWN TRACK")
        MusicAlbum = GetExtra(StartingIntent, "album", "UNKNOWN ALBUM")
        MusicArtist = GetExtra(StartingIntent, "artist", "UNKNOWN ARTIST")
        Log("Track changed to: " & MusicTrack & " (" & MusicAlbum & " - " & MusicArtist & ")")'substitute with whatever code you want to handle the change
    End If

This to your Process_Globals

Dim MusicArtist As String = "NO ARTIST", MusicAlbum As String = "NO ALBUM", MusicTrack As String = "NO TRACK", MusicCommand As String

And this anywhere in the service

Sub GetExtra(StartingIntent As Intent, Extra As String, Default As String) As String
    If startingintent.HasExtra(extra) Then Return startingintent.GetExtra(extra) Else Return default
End Sub