android - 适用于 Android 的 Spotify 远程 SDK - AuthenticationFailedException
问题描述
到目前为止,将 Spotify Remote SDK 集成到 android 应用程序中的步骤是:
1) 在 Spotify Dashboard 上创建应用程序配置文件,
2) 生成调试指纹
3) 生成的发布指纹
4) 通过运行“this.getPackageName()”确保包名称正确,该值与指纹一起放入 Spotify 仪表板。
我能够运行我的应用程序,并且在初始启动时,spotify 身份验证页面确实会出现。但是在 1 或 2 天后,进入调试阶段,函数 connect(_:) 突然失败并返回 AuthenticationFailedException 错误
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"); 这被执行。
在这一点上,我不确定后台发生了什么。指纹是否必须以某种方式动态更新?身份验证超时和 Spotify 本身是否需要重新登录?
解决方案
推荐阅读
- pytorch - PyTorch - 改变 Conv2d 的权重
- mongodb - 如何在 Rust 中使用 Mongodb::cursor?
- machine-learning - 如何部署没有预测属性的模型?
- javascript - 使用 JavaScript 在每 2 位小数后拆分一个字符串
- c# - IMetaDataEmit::DefineUserString 返回 HRESULT: -2147024882 (0x8007000E E_OUTOFMEMORY)
- sql - datasource.error microsoft sql:invalid column name 'generated_always_type' 错误代码:2146232060
- javascript - SwiperJS 平滑自动高度修复
- c# - Garbage Collection如何收集具有继承性的对象
- google-cast - Chromecast 调试 - 可以投射但不能检查
- python - 如何使用 python 访问运动生成器设备属性