react-native-spotify-remote icon indicating copy to clipboard operation
react-native-spotify-remote copied to clipboard

Event listeners are not triggered when app is running in the background

Open MehediH opened this issue 2 years ago • 3 comments

Any of the event listeners added to SpotifyRemote don't get triggered when the app is running in the background. It only works when the app is active and in focus - is this intentional?

Is there anyway to have the event listeners work even when the app is running in the background (including when the phone is locked)? Mainly need this for the playerStateChanged event. Thank you!

MehediH avatar Jan 24 '23 21:01 MehediH

hmm.. You're talking about within your app? I had a similar issue and it was due to iOS backgrounding / sleeping my app and disconnecting the remote connection with spotify. You just need to employ a strategy to keep your app from being backgrounded. There are a few sdk's that if in use will prevent iOS from backgrounding your app. Audio and GPS are two that come to mind that you could investigate.

It's pretty lame, I wish there was some sort of real time entitlement for iOS that you could use to prevent your app from being backgrounded. Maybe there is? worth an investigation.

cjam avatar Jan 30 '23 16:01 cjam

Yes within my app. Do you have an example of how you got it to stop iOS from backgrounding the app?

MehediH avatar Jan 30 '23 22:01 MehediH

Yes within my app. Do you have an example of how you got it to stop iOS from backgrounding the app?

Hello, @MehediH! Have you solved this problem?

Pashkagreen avatar Jan 16 '24 23:01 Pashkagreen