Announcements
From 28th September 2026, Community private messages will no longer be available. If you have any private messages you'd like to keep, please save or copy them using these steps before this date. Thank you.

Help Wizard

Step 1

NEXT STEP

Android SDK - subscribeToPlayerState called multiple times

Android SDK - subscribeToPlayerState called multiple times

Hi,

I'm a software engineer, and I'm working on a new application based on Spotify.

I started to played a playlist, and it's works.

 

But after, I tried to get the player state, and I don't know why, the function subscribeToPlayerState is called multiples times, for the same state, (for example, when the playlist starting, the playerstate is called 4 times the the same track).

It's a problem for me, because I need to start a process when the player state change.

 

I found some similiar subject on Github or stakeoverflow, but no one has a workarround.

 

Is there a way to prevent multiple playerstate called ?

Thanks in advance,

 

 

Reply
1 Reply

After some test, i saw that the first time, the function is called 6 times, and after (during next/previous track), it's called 4 times.
I did a workarround in my program with a counter, but now my program will be broken if spotify make an update of this.

I d'ont think this is the better solution

Suggested posts

Let's introduce ourselves!

Hey there you,   Yeah, you! 😁   Welcome - we're glad you joined the Spotify Community!   While you here, let's have a fun game and get…

ModeratorStaff / Moderator/ 5 years ago  in Social & Random