How does KWGT get media information from Spotify (code)?

Hi, I'm wondering how KWGT gets media information from Spotify such as the active song name, album art, and Play/Pause state. Note that this question is not about how to use KWGT, I'm interested in how KWGT is doing this with Android Java/Kotlin code.

I know that they've implemented a function called "mi()" that can be used to get things like Play/Pause state and Album Art:

mi(state) // play/pause state
mi(cover) // album art URI

I'm wondering how they've built that "mi()" function. I've tried to get the Play/Pause state and Album Art from Spotify myself with Android Kotlin code but nothing has worked.

Is there any code I could look at? Or examples of how this is done?

Nevermind, I figured it out: https://developer.spotify.com/documentation/android/guides/android-media-notifications/#sent-event-types

I specifically needed to enable "Device Broadcast Status" in my settings in spotify to get the official example to work 👍

Although I'm still a little stumped on how to get the album art in Bitmap form from the "albumId"

I found another solution from Spotify:

https://developer.spotify.com/documentation/android/quick-start/#introduction

They built an Android SDK library specifically for this.

When implementing this solution don't forget to add the following to your manifest file:

<queries>
<package android:name="com.spotify.music" />
</queries>