Android Question SPOTIFY INFO

pazzokli

Active Member
Licensed User
Longtime User
Hi friends,
I switched my Domotica APP on a new Tablet (Samsung Tab S4).
I use this code to retrieve song title from Spotify when running in background. It worked well
Now with Android 10 no.
What can I check?

B4X:
Sub crea_broadcast
    '''''' per avere info  da SPOTIFY                                    SPOTIFY
    Broadcast.Initialize("BroadcastReceiver")
    Broadcast.addAction("com.spotify.music.playbackstatechanged")
    Broadcast.addAction("com.spotify.music.metadatachanged")
    Broadcast.addAction("com.spotify.music.queuechanged")
    Broadcast.registerReceiver("")
    ''''''''''''''''''''''''''''''''''''''''''''''
End Sub


Sub BroadcastReceiver_OnReceive (Action As String, Intent As Object)

    Dim I As Intent = Intent
    Dim cd As ColorDrawable
    Log(Action)
  
    Select Action
        Case "com.spotify.music.playbackstatechanged"
            Log(I.getExtra("playing"))
            If I.getExtra("playing")= False Then    '    spotify è spento
                lbl_info_brano.Visible=False
                
                cd.Initialize2(Colors.ARGB(255,0,255,255),30dip,3dip,Colors.ARGB(255,240,26,37))
                BTN_0_BOTTONE5.TextColor=Colors.Black
                
                BTN_0_BOTTONE5.Background=cd
                txt6.Text="spotify"
                txt6.TextColor=Colors.Black
                
                tel.SetVolume(tel.VOLUME_MUSIC,tel.GetMaxVolume(tel.VOLUME_MUSIC ),False)
            End If
            If I.getExtra("playing")= True Then        '    spotify suona
                lbl_info_brano.Visible=True
                BTN_0_BOTTONE5.TextColor=Colors.Green
                
            txt6.Text="suonando"
            txt6.TextColor=Colors.Green
                cd.Initialize2(Colors.Black ,30dip,3dip,Colors.ARGB(255,240,26,37))
                BTN_0_BOTTONE5.Background=cd
                
            End If
            Return
            Log(I.getExtra("playbackPosition"))
        Case "com.spotify.music.metadatachanged"
            lbl_info_brano.Text= "stai ascoltando '" & I.getExtra("track") & "' cantata da " & I.getExtra("artist") & " dall'album '" & I.getExtra("album") & "'"
    End Select
 
Top