Announcements

Help Wizard

Step 1

NEXT STEP

Samsung Galaxy authorization

Samsung Galaxy authorization

Device

Various models of Samsung Galaxy phones. Such as A53.

Operating System

Android

 

My Question or Issue

I developed an Android application, using Kotlin. When Spotify is installed on the phone, the application will connect to it and show the track that's currently playing.

The application works on Pixel phones but doesn't work on Samsung Galaxy.

The failure is when trying to connect to SpotifyAppRemote. It fails silently i.e. both onSuccess and onFailure aren't called.
Below is the connection function. When running it, we see the "Calling SpotifyAppRemote.connect()" message but not any of the following messages.

``private fun connectToSpotifyAppRemote() {
Log.d("SpotifyDJ", "Connecting to SpotifyAppRemote with CLIENT_ID=$CLIENT_ID, REDIRECT_URI=$REDIRECT_URI")
val connectionParams = ConnectionParams.Builder(CLIENT_ID)
.setRedirectUri(REDIRECT_URI)
.showAuthView(true)
.build()
Log.d("SpotifyDJ", "Calling SpotifyAppRemote.connect()")
SpotifyAppRemote.connect(this, connectionParams, object : Connector.ConnectionListener {
override fun onConnected(appRemote: SpotifyAppRemote) {
Log.d("SpotifyDJ", "SpotifyAppRemote connected in MainActivity")
spotifyAppRemote = appRemote
// Pass the connected instance to MainService if bound
if (isServiceBound) {
mainService?.setSpotifyAppRemote(appRemote)
}
}
override fun onFailure(error: Throwable) {
Log.e("SpotifyDJ", "SpotifyAppRemote connection failed in MainActivity", error)
// Optionally notify MainService or ViewModel if needed
}
})
}```

 

Reply
1 Reply

Hi @benbloom 

Thank you for the detailed log.

For trouble shooting, were you playing Spotify DJ when the app die not work, or is this the name of that the name of your app.

If it the first case, the issue is maybe caused by the SDK not being compatible with Spotify DJ.

Could you please test if you get the same error on your pixel phone with the same scenario?

And does this also happen with other playlists made by Spotify on both phones?

Thank you in advance.

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

Suggested posts

Let's introduce ourselves!

Hey there you,   Yeah, you! 😁   Welcome - we're glad you joined the Spotify Community!   While you here, let's have a fun game and get…

ModeratorStaff / Moderator/ 4 years ago  in Social & Random