Spotify API: INVALID_APP_ID

I am currently working on an Android application that implements the Spotify API. I have all the code connecting my application to reveal it with the help of a tutorial, and now I'm working on my application. When I launch a song through my application after user authentication, it works fine, that is, on my emulator. When I switch it to my phone, it does not work and gave me the INVALID_APP_ID error in the android response. When I deleted the selection from my phone and then tried to log in to determine through my application, then I was able to play music from the phone without any glitches. So my question is: how do I fix this? Here is my code for user authentication:

@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()); } }); } } } 
+9
android spotify libspotify
source share
4 answers

You need to go to the Spotify developer settings and update

Android packages

Providing the full name of the package, i.e. com.company.app and the SHA1 fingerprint of the corresponding build option.

You can get a fingerprint by running

 ./gradlew signingReport 

Here you can find the results, for example. 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 

Saving the settings on the Spotify app page is enough to clean up the system so you can log in from your device.

+3
source share

I think this is the answer to your question:

https://github.com/expo/expo/issues/892

(I had the same problem, I used this SHA1 value, and it worked ...)

FROM.

0
source share

Spotify requires SHA1 debugging during development. After you have released your application, you need to add the SHA1 release for your application along with the name of your package, as shown in AndroidManifest. Add this via the Spotify Dashboard for your app in the Android Packages section.

To find out SHA1 for released APKs, you first need to create a signed APK from Android Studio.

Then, be sure to add the following to your build.gradle application:

 android { //... signingConfigs { release { storeFile file('KEY_STORE_PATH_FOR_YOUR_APK') storePassword 'YOUR_PW' keyAlias 'YOUR_KEY_ALIAS' keyPassword 'YOUR_KEY_PW' } } buildTypes { //... release { signingConfig signingConfigs.release } } //... } 

This will allow you to print the release and debug SHA1 in Logcat. In Android Studio, open the Gradle terminal and set signingReport as the signingReport command line. Click OK and the value will be printed.

Why is this needed?

When the user has already installed the Spotify application and is already logged in, there is no need to log in again for your application. This will be done automatically in the background using OAuth which requires SHA1. If Spotify is not installed, SHA1 is not required, and instead, the user is prompted to log into your application. However, if the user has the Spotify application installed, there is no way to show the login prompt in your application ... therefore, the login will fail if SHA1 is not available.

0
source share

The answers above were helpful. However, this was another problem that took me by surprise.

As part of the release management process, the game store offers release key management. If you enable this feature, the SHA-1 certificate for the application will be replaced before it is delivered to users. You must ensure that the new key is also registered on the spotify developer console.

To view the new key, open the Google Play Store Developer Toolbar and click on “Release Management> Signing Application”. You should see the key here.

0
source share

All Articles