gpt4 book ai didi

android - Spotify API : INVALID_APP_ID

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:08:48 24 4
gpt4 key购买 nike

我目前正在开发一个实现 Spotify API 的 Android 应用程序。我拥有使用教程将我的应用程序连接到 Spotify 的所有代码,并且现在已经在我的应用程序上工作了一段时间。当我在验证用户身份后通过我的应用程序播放歌曲时,它在我的模拟器上完美运行。当我将它切换到我的手机时,它不起作用,并在 android 响应中给我一个 INVALID_APP_ID 错误。当我从我的手机上卸载 spotify 然后尝试通过我的应用程序登录 spotify 时,我就可以从我的手机播放音乐而不会出现任何崩溃。所以我的问题是我该如何解决?这是我用于验证用户的代码:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);

// Check if result comes from the correct activity
if (requestCode == requestcode) {
AuthenticationResponse response = AuthenticationClient.getResponse(resultCode, intent);
if (response.getType() == AuthenticationResponse.Type.TOKEN) {
Config playerConfig = new Config(this, response.getAccessToken(), client_id);
token = response.getAccessToken();
Spotify.getPlayer(playerConfig, this, new Player.InitializationObserver() {
@Override
public void onInitialized(Player player) {
mPlayer = player;
mPlayer.addConnectionStateCallback(.this);
mPlayer.addPlayerNotificationCallback(.this);

}

@Override
public void onError(Throwable throwable) {
Log.e("MainActivity", "Could not initialize player: " + throwable.getMessage());
}
});
}
}
}

最佳答案

您需要转到您的 Spotify 开发者设置并更新

Android Packages

提供您的完整包名,即 com.company.app以及相应构建变体的 SHA1 指纹。

可以通过运行获取指纹

./gradlew signingReport

在那里您可以找到例如调试

Variant: debug
Config: debug
Store: /Users/<your username>/.android/debug.keystore
Alias: AndroidDebugKey
MD5: 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
SHA1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
Valid until: Monday, August 29, 2046

在您的 Spotify 应用程序页面上保存设置足以刷新系统,以便您可以从您的设备登录。

关于android - Spotify API : INVALID_APP_ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34908193/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com