spotify / android-sdk

Spotify SDK for Android
https://developer.spotify.com/documentation/android/
Apache License 2.0
462 stars 119 forks source link

`CouldNotFindSpotifyApp` exception being thrown when Spotify App is installed #219

Open ghost opened 4 years ago

ghost commented 4 years ago

Issue found on March 2, 2020.

SDK Version:

OS Version:

Android 4.4+

Scope(s):

Steps to reproduce:

  1. have the Spotify app installed and be logged in.
  2. on a secondary app that uses the Spotify SDK, try to connect to the Spotify:
val connectionParams = ConnectionParams
    .Builder(context.getString(R.string.spotify_client_id))
    .setRedirectUri(context.getString(R.string.spotify_redirect_uri))
    .showAuthView(redirectToLoginIfNeeded)
    .build()
SpotifyAppRemote.connect(
    context,
    connectionParams,
    object : Connector.ConnectionListener {
        override fun onFailure(throwable: Throwable?) {
            // Failed
        }

        override fun onConnected(spotifyAppRemote: SpotifyAppRemote?) {
            // Succeeded
        }
    }
)

Expected behaviour:

Successfully connect to Spotify

Actual behaviour:

For some users, the CouldNotFindSpotifyApp exception is thrown even though the user has the Spotify App installed on his device.

P.S.

Unfortunately we could not reproduce that misbehavior locally, but we have some users complaining about it.

ghost commented 4 years ago

Hi o/

Is Spotify still giving support to this repository/sdk?

EagleOne33 commented 4 years ago

what else should we use..? :/

ghost commented 4 years ago

A new info has been given by one of the users. The user said that that problem started to happen after he had his device formatted.


@mdelolmo, Hi o/. Do you know if anyone from Spotify is currently working on the Spotify SDK for Android? This issue and several others have been opened for a long time without any reply from the Spotify team.

Thanks :D

ChristopherCarignan commented 4 years ago

Same problem here, can't find a solution anywhere and Spotify doesn't seem to want to help.

I tried rolling back to an older version (0.6.0) of the App Remote .aar, but it is the same problem as with the current version (0.7.1)

Reproducible on Pixel 3 AVD and on actual Pixel 3, both with Spotify installed.

ChristopherCarignan commented 4 years ago

Apparently, I needed to allow Spotify to be searched before trying to search for it! This may be common knowledge, but it wasn't to me.

Added this to the manifest file:

<queries>
    <package android:name="com.spotify.music" />
</queries>
calebschoepp commented 3 years ago

@ChristopherCarignan I was having the exact same issue. Your fix worked! THANK YOU! This requirement should really be more clearly communicated by Spotify.

ghost commented 3 years ago

Hi. Sorry for my late reply, @ChristopherCarignan. But that's a bit strange. The problem comes long before the release of Android 11, so I believe it may still happen even after adding those lines to the AndroidManifest.

Android 11 was released around September / 2020. The problem comes from long before March / 2020.

image

ahmadajmal9301 commented 1 year ago

Is there a solution to this? I've tried the solution that @ChristopherCarignan gave but the issue still remains.