我遵循了 android 身份验证指南和快速入门指南中的所有内容。我按照指南告诉我生成一个 SHA1 并将其添加到 Spotify 应用程序仪表板,我得到了 app_client 并将其添加到我的应用程序中。这两种情况仍然返回相同的东西。我什至尝试实现通过浏览器登录功能,但它仍然返回类型 EMPTY。
这是我的登录类
class SignInActivity : AppCompatActivity(), ConnectionStateCallback, Player.NotificationCallback {
private var mPlayer : SpotifyPlayer? = null
private val CLIENT_ID = //replace this
private val REDIRECT_URI = //replace this
private val REQUEST_CODE = 1337
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_login)
btnSignin.setOnClickListener {
val builder = AuthenticationRequest.Builder(CLIENT_ID, AuthenticationResponse.Type.TOKEN, REDIRECT_URI)
builder.setScopes(arrayOf("user-read-private", "streaming"))
val request = builder.build()
AuthenticationClient.openLoginActivity(this, REQUEST_CODE, request)
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) …Run Code Online (Sandbox Code Playgroud)