Skip to content

Application Lifecycle

When the App Remote SDK wants to wake up the Spotify client it must perform an app switch to do so. The Spotify client will use the redirect URI you have registered on the Developer Dashboard to switch back to your app once the user has approved the authorization (or once a token is retrieved if the user has already approved your app).

In order to make sure your app doesn't error during iOS App Switching, we recommend disconnecting the App Remote when your app is inactive, and reconnecting when your app is re-activated:


_11
- (void)applicationWillResignActive:(UIApplication *)application {
_11
if (self.appRemote.isConnected) {
_11
[self.appRemote disconnect];
_11
}
_11
}
_11
_11
- (void)applicationDidBecomeActive:(UIApplication *)application {
_11
if (self.appRemote.connectionParameters.accessToken) {
_11
[self.appRemote connect];
_11
}
_11
}

Please note that currently an app switch is required to resume playback when the user pauses the music. We recommend having a button that says "Resume Playback" or "Open Spotify" if App Remote is not connected so it's clear to the user an app switch will occur. You should still show a normal play button if App Remote is connected and the music is paused however.