Roc*_*ish 10 android spotify libspotify
我目前正在开发一个实现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());
}
});
}
}
}
Run Code Online (Sandbox Code Playgroud)
您需要转到Spotify开发人员设置并更新
Android套餐
提供完整的软件包名称,即com.company.app
相应构建版本的SHA1指纹。
您可以通过运行获取指纹
./gradlew signingReport
Run Code Online (Sandbox Code Playgroud)
在那里您可以找到例如的结果 debug
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
Run Code Online (Sandbox Code Playgroud)
将设置保存在Spotify应用程序页面上足以刷新系统,以便您可以从设备登录。
| 归档时间: |
|
| 查看次数: |
2590 次 |
| 最近记录: |