- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
final AuthenticationRequest request = new AuthenticationRequest.Builder(CLIENT_ID, AuthenticationResponse.Type.TOKEN, REDIRECT_URI)
.setScopes(new String[]{"playlist-read"})
.build();
AuthenticationClient.openLoginActivity(this, REQUEST_CODE, request);
上面是点击登录按钮后运行的代码。此代码在模拟器上运行时运行良好。下面是 onActivityResult:
if (requestCode == REQUEST_CODE) {
AuthenticationResponse response = AuthenticationClient.getResponse(resultCode, intent);
switch (response.getType()) {
// Response was successful and contains auth token
case TOKEN:
logMessage("Got token: " + response.getAccessToken());
CredentialsHandler.setToken(this, response.getAccessToken(), response.getExpiresIn(), TimeUnit.SECONDS);
startMainActivity(response.getAccessToken());
break;
// Auth flow returned an error
case ERROR:
logError("Auth error: " + response.getError());
break;
// Most likely auth flow was cancelled
default:
logError("Auth result: " + response.getType());
}
}
当应用程序在安装了 Spotify 应用程序的设备上运行时,response.getType() 返回错误,response.getError() 为 INVALID_APP_ID。
我的应用程序包名称和 SHA-1 指纹在 Spotify 的开发门户中输入,这应该不是问题,因为它可以在模拟器上运行。为什么不在响应中发送 token ?提前致谢!
PS:澄清一下,这不是 Spotify API: INVALID_APP_ID 的副本
帖子的回答是把SHA-1指纹和包名放到portal里,我已经这么做了。
最佳答案
您应该在 https://developer.spotify.com/dashboard/ 上的项目设置中添加(调试和发布)SHA1 指纹和包名.
参见 https://developers.google.com/android/guides/client-auth寻求有关如何获取 SHA1 的帮助。
关于java - Spotify 安卓 SDK : INVALID_APP_ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41787548/
我目前正在开发一个实现 Spotify API 的 Android 应用程序。我拥有使用教程将我的应用程序连接到 Spotify 的所有代码,并且现在已经在我的应用程序上工作了一段时间。当我在验证用户
final AuthenticationRequest request = new AuthenticationRequest.Builder(CLIENT_ID, AuthenticationRes
我是一名优秀的程序员,十分优秀!