The steps that have been taken thus far to integrate the Spotify Remote SDK into an android application are:
1) Created application profile on Spotify Dashboard,
2) Generated Debug Fingerprint
3) Generated Release Fingerprint
4) Ensured package name is correct from running ' this.getPackageName() ' which the value is placed into Spotify Dashboard alongside the fingerprint.
I am able to run my application and upon initial launch, the spotify authentication page does present itself. However after 1 or 2 days, and into debugging, Out of nowhere the function connect(_:) fails and returns AuthenticationFailedException error
if (SpotifyAppRemote.isSpotifyInstalled(this)) {
ConnectionParams connectionParams =
new ConnectionParams.Builder(CLIENT_ID)
.setRedirectUri(REDIRECT_URI)
.showAuthView(true)
.build();
SpotifyAppRemote.connect(this, connectionParams,
new Connector.ConnectionListener() {
@Override
public void onConnected(SpotifyAppRemote spotifyAppRemote) {
musicPlayer = spotifyAppRemote;
Log.d(TAG, "Connected! Yay!");
}
public void onFailure(Throwable error) {
if (error instanceof SpotifyRemoteServiceException) {
if (error.getCause() instanceof SecurityException) {
logError(error, "SecurityException");
} else if (error.getCause() instanceof IllegalStateException) {
logError(error, "IllegalStateException");
}
} else if (error instanceof NotLoggedInException) {
logError(error, "NotLoggedInException");
} else if (error instanceof AuthenticationFailedException) {
logError(error, "AuthenticationFailedException");
} else if (error instanceof CouldNotFindSpotifyApp) {
logError(error, "CouldNotFindSpotifyApp");
} else if (error instanceof LoggedOutException) {
logError(error, "LoggedOutException");
} else if (error instanceof OfflineModeException) {
logError(error, "OfflineModeException");
} else if (error instanceof UserNotAuthorizedException) {
logError(error, "UserNotAuthorizedException");
} else if (error instanceof UnsupportedFeatureVersionException) {
logError(error, "UnsupportedFeatureVersionException");
} else if (error instanceof SpotifyDisconnectedException) {
logError(error, "SpotifyDisconnectedException");
} else if (error instanceof SpotifyConnectionTerminatedException) {
logError(error, "SpotifyConnectionTerminatedException");
} else {
logError(error, String.format("Connection failed: %s", error));
}
}
});
}
logError(error, "AuthenticationFailedException"); this gets executed.
At this point, I am unsure of what is going on in the background. Does the fingerprint have to somehow be dynamically updated? Does authentication timeout and Spotify itself requires to be relogged into?